Wizcorp / phonegap-facebook-plugin: failed to create ios

When I try to start the ionic ios build or try to create an archive for the xcode project created using ionic i get this error

** FacebookConnectPlugin.m **: 27:44: error: no @interface visible for 'CDVPlugin' declares selector 'initWithWebView:' self = (FacebookConnectPlugin *) [super initWithWebView: theWebView]; ~~~~~ ^ ~~~~~~~~~~~~~~ / Applications / MAMP / htdocs / hybrid -mobile-app / platforms / ios / qudratApp / Plugins / phonegap-facebook-plugin / FacebookConnectPlugin.m : 238: 28: warning: comparing constant 2 with a boolean expression is always false [-Wtautological-constant-out-of-range-compare] if (! Command.arguments == 2) {~~~~~~~~~~ ~~~~~~~~ ^ ~ ~ 1 warning and 1 error generated.

** BUILD FAILED **

The following build commands failed: CompileC build / qudratApp.build / Debug-iphonesimulatorqudratApp.build / Objects-normal / i386 / FacebookConnectPlugin.o qudratApp / Plugins / PhoneGap-facebook-plugin / FacebookConnectPlugin.m normal i386 objective-c com.apple .compilers.llvm.clang.1_0.compiler (1 error) Error: Error code 65 for the command: xcodebuild with args: -xcconfig, / Application / MAMP / HTDOCS / hybrid mobile applications / platforms / iOS / Cordova / build debug.xcconfig , -project, qudratApp.xcodeproj, arches = i386, -target, qudratApp, -configuration, debugging, - SDK, iphonesimulator, build, VALID_ARCHS = i386, CONFIGURATION_BUILD_DIR = / Application / MAMP / HTDOCS / hybrid mobile applications / platforms assembly / emulator, SHARED_PRECOMPS_DIR = / Applications / MAMP / HTDOCS / hybrid mobile applications / platforms / iOS / assemblies / sharedpch

+6
source share
2 answers

I installed facebook facebook through a localized cloned copy and also added the FacebookSDK.framework file to Xcode again after installation, but none of this worked for me. As I decided to install https://github.com/jeduan/cordova-plugin-facebook4 .

  • Remove the phonegap plugin:

    ionic plugin rm phonegap-facebook-plugin

  • Clone the following plugin:

    git clone https://github.com/jeduan/cordova-plugin-facebook4.git

  • Add the plugin manually:

    cordova -d plugin add PATH/cordova-plugin-facebook4 --variable APP_ID="*****" --variable APP_NAME="*****"

Here's how it works for me.

+7
source

You can solve this in two ways:

1- replace [super initWithWebView:theWebView] with [super init] .

2- add the compiler flag to FacebookConnectPlugin.m to disable ARC, the compiler flag is fno-objc-arc

From my point of view, I recommend the second solution because it does not affect the code.

If you are looking for a step-by-step solution, do the following in Xcode.

  • Select the main project.
  • Choose a target
  • Go to build steps
  • Expand the compiled resources, select "FacebookConnectPlugin.m"
  • On the right side of "FacebookConnectPlugin.m" you can add the following compiler flag

    -fno-objc-arc

Now, if you want to understand the problem in detail:

FacebookConnectPlugin.m was created in an environment other than ARC, and it controls memory consumption. but Xcode does not allow this to use ARC to control memory consumption for the entire application. therefore, the solution for this conflict is to update the FacebookConnectPlugin.m code to use ARC or simply tell Xcode that you are responsible for managing the memory of this class by adding a compiler flag.

+1
source

All Articles