Monday 4 March 2013

Facebook Connect with PhoneGap Build

This is really fiddly to get working. Here are two big "gotchas" that caught me out.

1. FB.login() requires extra paramters

Wrong:
FB.login(myCallbackFunction);
Right:
FB.login(myCallbackFunction, { scope: 'email' });
Even if you don't want the users email, you MUST supply this scope or the login call will fail wit h really weird JS errors.

2. Your Facebook iOS App ID must match your ID in the Apple Portal (not in PG config.xml)
The App ID which you define in your config.xml (widget id='x') is NOT the one which matters.

What matters is the App ID you configured when you generated the provisioning profile for your app via the Apple Portal. This is the App ID which you must enter into your Facebook App:
Native iOS App > Bundle ID > com.me.myApp
But do not include the prefix (SDGH34SD style) that you see in the Apple Portal.

More links covering other issues here:
http://pjsdev.blogspot.com.au/2013/02/phonegap-build-facebook-connect.html