Reputation: 354
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
Upvotes: 7
Views: 2315
Reputation: 10532
As of today the plugin https://github.com/jeduan/cordova-plugin-facebook4 still works on Android
, but not on iOS
anymore. The fork https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect with exactly the same API/CLI command works on iOS
and I fixed the problem using https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect.
Upvotes: 0
Reputation: 435
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.
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.
Upvotes: 1
Reputation: 1079
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.
Remove the phonegap plugin:
ionic plugin rm phonegap-facebook-plugin
Clone the next 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="*****"
Thats how it works to me.
Upvotes: 7