Search code examples
phonegap-pluginsphonegap-build

Facebook plugin: init not called with valid version


I use phonegap build to create debug version for android. I want to use facebook plugin. In Config.xml I have

<gap:plugin name="com.phonegap.plugins.facebookconnect" version="0.4.0">
    <param name="APP_ID" value="509210995889450" />
    <param name="APP_NAME" value="Food share" />
  </gap:plugin>

I use the file facebookConnectPlugin.js which is from the official plugin Github for facebook. calling:

  facebookConnectPlugin.login([], success, fail);

I get: Error: init not called with valid version Error at Object. (http://connect.facebook.net/en_US/sdk.js:37:148) at window.FB.require (http://connect.facebook.net/en_US/sdk.js:15:588) at window.FB.require (http://connect.facebook.net/en_US/sdk.js:15:550) at window.FB.require (http://connect.facebook.net/en_US/sdk.js:15:550) at window.FB.require (http://connect.facebook.net/en_US/sdk.js:15:550) at window.FB.require (http://connect.facebook.net/en_US/sdk.js:15:550) at window.FB.require (http://connect.facebook.net/en_US/sdk.js:15:550) at window.FB.require (http://connect.facebook.net/en_US/sdk.js:15:550) at window.FB.require (http://connect.facebook.net/en_US/sdk.js:15:550) at window.FB.require (http://connect.facebook.net/en_US/sdk.js:15:550)


Solution

  • My mistake was that I tried to work with the official Phonegap plugin for facebook. It seems Phonegap build uses another plugin, which doesn't use javascript facebookConnectPlugin, as is mentioned in their documentation. So I used https://github.com/Wizcorp/phonegap-facebook-plugin And they use https://github.com/phonegap-build/FacebookConnect/tree/962eb0a1c07935ff813e28aa9eaa5581f2e10416 And usage is different. Very confusing. Also makes it difficult if you try first to build on your desktop, and then it doesn't work on Phonegap Build.