Issue with Facebook plugin on iOS

Hi,

I would like to use Facebook Login in my app.

I installed the Facebook plugin like this :

cordova -d plugin add /Users/your/path/here/phonegap-facebook-plugin --variable APP_ID="123456789" --variable APP_NAME="myApplication"

But when i try to run ios, that fails.
So i removed ios platform, and added it again.

Usually that works for another plugin, but this time, i got this error message :

Failed to install 'com.phonegap.plugins.facebookconnect':Error: Variable(s) missing: APP_ID, APP_NAME

Indeed, it tries to install the plugin automatically but without the informations of the APP_ID and the APP_NAME, that fails.

Any help to get around this issue ?

Thank you :blush:

I found a solution.

Before launching ionic platform add ios, i edited the plugin.xml file in the facebook plugin folder :

preferences name="APP_ID"
preferences name="APP_NAME"

to:

params name="APP_ID" value="facebook-app-id"
params name="APP_NAME" value="facebook-app-name"

Now i can run ios again.

4 Likes

I’m trying to run this plugin on my iOS, but it open a modal to enter the facebook email and password, but on Android it uses the Facebook app already installed in device…

I could run is correctly on iOS? It’s using the native login or asking to login on Facebook?

Hi,
You should be able to open the Facebook app login on iOS. Is it now ok for you ?

Hi @sh4rky I forgot to add the URL Scheme fb[my_app_id], now it’s working fine. Thanks :slight_smile:
ref: https://developers.facebook.com/docs/ios/getting-started#configurePlist

@sh4rky about your first question, you need to clone the plugin repository because of a bug with cordova.

Here is some explanation https://github.com/Wizcorp/phonegap-facebook-plugin/blob/master/platforms/ios/README.md#install

Clone the repository, and install the plugin locally and the variables will work fine.

I was looking for the same answer and have found this app which is made with Ionic and a cordova facebook plugin and offers a native Facebook login and other Facebook options such as share links and photos and send messages to your friends. It worked fine for me and includes a great guide on how to integrate the facebook plugin to your existing app.
You can check it in the following link: http://codecanyon.net/item/ionic-phonegapcordova-facebook-native-integration/10228279?ref=recommended_for_you

Hope it helps!