Facebook “error 2” with Phonegap Build Facebook Connect Plugin on ios
OK, I'm experiencing the "Error 2" problem and there are lots of questions / answers about this on this site. Here's a very well put-together one:
However, while my error is the same, my situation is different and none of the presented fixes have worked for me.
I'm using Phonegap Build @ 2.5.0 with the included Phonegap Build Facebook Connect plugin. This works in all situations and on all devices except for iOS devices that the user has logged on to Facebook via Settings --> Facebook. I've confirmed that it makes no difference if the user is logged into the Facebook app, just if their phone is logged into Facebook.
Here's the full error message: "The operation couldn't be completed. (com.facebook.sdk error 2.)"
Other answers and other sites on the web have suggested these possible problems:
- BundleIdentifier and BundleURLName in my info.plist file don't match the Bundle ID under Native iOS app in the settings of my Facebook app.
- The app is still in Sandbox mode
- The app is disabled in the Facebook Settings (device's settings -> Facebook -> Allow These Apps To Use Your Account).
- iOS 6.0 doesn't allow for the asking of read and write permissions at the same time.
However, my bundle IDs are correct. I'm not in Sandbox mode in Facebook. It's enabled under Facebook settings and I'm not asking for read and write permissions at the same time.
I can fix the problem sure enough by logging out of the phone's connection to Facebook. Also, if I login to my app and then log the phone into Facebook, the app still works fine. This suggests a permission or error to me.
Can anyone please shed some light on this for me? Thanks.
For posterity, the problem was that I was asking for read permissions on the initial login and then I asked for ALL permissions again when I wanted to write. I only should have been asking for the incremental write permissions when I wanted to write to Facebook.