6
votes

When i try to run ionic build ios or try to build archive for the xcode project created by ionic i get this error

**FacebookConnectPlugin.m**:27:44: error: no visible @interface for 'CDVPlugin' declares the 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: comparison of constant 2 with 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 failure) Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Applications/MAMP/htdocs/hybrid-mobile-app/platforms/ios/cordova/build-debug.xcconfig,-project,qudratApp.xcodeproj,ARCHS=i386,-target,qudratApp,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Applications/MAMP/htdocs/hybrid-mobile-app/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Applications/MAMP/htdocs/hybrid-mobile-app/platforms/ios/build/sharedpch

2
You having much luck with this issue? i'm on my second day and still no luck. Our errors do look slightly different, but much the same with @interface for 'CDVPlugin'.Rodrigo Rubio
Nopes no luck still, i have removed facebook from ios for now untill i get a fix for it, What exactly is your errorAmmar Ajmal

2 Answers

7
votes

I installed the phonegap plugin facebook through a locally cloned copy and also re-add the FacebookSDK.framework to Xcode after installation, but none of this worked to me. The way I solved was installing https://github.com/jeduan/cordova-plugin-facebook4.

  1. Remove the phonegap plugin:

    ionic plugin rm phonegap-facebook-plugin

  2. Clone the next plugin:

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

  3. Add the plugin manually:

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

Thats how it works to me.

1
votes

You can Solve this in 2 ways:

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

2- add a 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's not affecting the code.

if you are looking for a step by step solution do the following in Xcode.

  1. Select your main project.
  2. Select your target
  3. Go to build phases
  4. Expand the compiled resources tap select "FacebookConnectPlugin.m"
  5. At the right side of the "FacebookConnectPlugin.m", you can add the following compiler flag

    -fno-objc-arc

Now if you want to understand the problem in details:

The FacebookConnectPlugin.m was built under non-ARC environment and he controls his memory consumption. but Xcode doesn't allow that as it's using ARC to control the memory consumption of the whole app. so the solution for this conflict is to revamp the FacebookConnectPlugin.m Code to use ARC or simply tell the Xcode that you are responsible for the memory management of this class by adding the compiler flag.