I have a Phonegap app that runs on both iOS and Android. The app has a Facebook login feature which worked until a few days ago. A few of our beta testers have reported an \
we had the same issue. As it turns out, reason is really in timeout on FB side, and especially if this timeout occurs while "FB login" page is still on, and user clicks on "cancel". In that case, error 2 is always retuned. So, if you want to repeat and test this situation, just click on "cancel" button while connecting on FB.
For me the reason was that I was testing my app on simulator. I wanted to share a photo and the dialog just didn't come up so I plugged in my iPhone and everything went smoothly afterwards!
I was figuring out the reason of this error for a long time as far as I work with old iOS 5.0 for bigger devices coverage. I've just recieved error 400 through facebook request debug. So finally, I figured out that the reason was in unknown FBSessionDefaultAudience for FBSession (was testing at 6.0+ and native facebook api gave me an error reason). And when I used
+ (BOOL)openActiveSessionWithPublishPermissions:(NSArray*)publishPermissions
defaultAudience:(FBSessionDefaultAudience)defaultAudience
allowLoginUI:(BOOL)allowLoginUI
completionHandler:(FBSessionStateHandler)handler;
this error finally dissappeared.
TRY FIRST:
Go to Settings app -> Facebook -> Your App -> Switch it off and back on again.
This worked for me, and didn't require me to actually delete the fb account and log back in as @seans23 suggests. If it hadn't worked, I would've tried that next, but this apparently did trick in resetting the state.
Turns out: a com.facebook.sdk error 2 can translate into a number of things. I'm looking for some kind of Facebook SDK error translation table, but I'm unable to find one. In my case: The com.facebook.sdk error 2 happened because the connection timed out. Users who got this error had a bad network/WiFi connection.
We implemented an error logging system, which logged the error details every time an error happened while logging into Facebook. In those logs we could see a com.facebook.sdk error 2 happening quite a lot, but it being resolved every time the user tried to log in again after a few seconds.
It might be due to my inability to find the right documentation, but I was and still am quite frustrated about the vagueness of these SDK errors. There is a lot of documentation about permission asking (which can result into the com.facebook.sdk error 2), but apparently this error can be caused by more things. It would be nice to see this documented somewhere as well.
This approach worked for me. (iOS 8)
The context:
The solution:
The idea is to remove both the Facebook App and the Messenger.