Software Archive
Read-only legacy content
17061 Discussions

Well 5.4.1 build fails with facebook plugin on iOS and Android

Alessandro_S_
Beginner
475 Views

build fails with facebook plugin

see log. Please help we are a startup with product on store and we need to upgrade often

0 Kudos
6 Replies
PaulF_IntelCorp
Employee
475 Views

Looking at the logios.txt build log, this appears to be the key problem:

.../builds/build.2016-03-24.11-47-58.4q4dRP.tmp/testVisitami/platforms/ios/testVisitami/Plugins/phonegap-facebook-plugin/FacebookConnectPlugin.m:27:44: error: no visible @interface for 'CDVPlugin' declares the selector 'initWithWebView:'
    self = (FacebookConnectPlugin *)[super initWithWebView:theWebView];
                                     ~~~~~ ^~~~~~~~~~~~~~~
.../builds/build.2016-03-24.11-47-58.4q4dRP.tmp/testVisitami/platforms/ios/testVisitami/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.

The first bit re: initWithWebView...

I'm guessing this is because the plugin has not been properly updated for use with cordova-ios@5.x. Two things to try:

  • build with CLI 5.1.1 or
  • try an alternate plugin (cordova-plugin-facebook4) with CLI 5.4.1

The errors in the logandroid.txt are not so obvious...

The facebook4 plugin is a drop-in replacement for the other plugin. You may experience some strange errors if you uninstall the facebook4 plugin, do not be alarmed, it is a cordova plugin add/remove issue. It can be fixed...

0 Kudos
Alessandro_S_
Beginner
475 Views
Ok thank you but is there any chance to get my facebook plugin working with 5.4.1? In android changing version of other plugins of my project the build succeds. Ios not anyway
0 Kudos
PaulF_IntelCorp
Employee
475 Views

Alessandro -- That facebook plugin has gotten quite old now, and uses some old methods for including the supporting Android libraries. I recommend you remove it and use cordova-plugin-facebook4, which is up-to-date.

If you run into problems removing the facebook plugin, do the following:

  • exit the XDK
  • open the <project-name>/plugins directory with a TEXT editor (Sublime, Brackets, Notepad++, vi, etc.)
  • remove all object elements for the facebook plugin from each of the four *.json files (android.json, ios.json, windows.json and fetch.json) located in that plugins directory (be careful to insure that you still have a valid JSON file, watch the commas!)
  • make a backup copy of your <project-name>.xdk file
  • open the <project-name>.xdk file in the root of your project (this is also a JSON file) and remove the object element that refers to the facebook plugin
  • remove the facebook plugin directory that is inside the <project-name>/plugins directory
  • restart the XDK and open your project, the facebook plugin should be gone

You can add the cordova-plugin-facebook4 plugin using the third-party plugin option, adding it as a Cordova registry plugin, and referencing it by name: cordova-plugin-facebook4. Note that the latest version of this facebook4 plugin requires a minimum Android API level of 15, your app is probably set to 14, so you'll need to increase that to 15 to use the version 1.7.0 of that plugin. I suspect the previous version (1.6.5) may work with min API of 14, I have not confirmed this. You'll have to specify version 1.6.5 in the version field of the plugin manager if you want to try that version. API level 15 corresponds to Android 4.0.3, so versions of Android less than 4.0.3 would not be supported.

0 Kudos
Alessandro_S_
Beginner
475 Views
Ok but should I change anything in my code? Or api are the same?
0 Kudos
PaulF_IntelCorp
Employee
475 Views

It is a drop-in replacement, your existing code should work. Double-check in the plugin's docs.

0 Kudos
Amrita_C_Intel
Employee
475 Views

And you can also refer to this article: https://software.intel.com/en-us/xdk/article/facebook-connect-plugin-android-ios

0 Kudos
Reply