Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

com.facebook.sdk error 2 on iOS

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 'The operation couldn't be completed com.facebook.sdk error 2' error. The devices of these testers vary: iPhone 5, iPhone 4s, iPod Touch, iOS 5.1.1 and iOS 6.0.

We use the latest Facebook SDK and a Phonegap Facebook login plugin (https://github.com/davejohnson/phonegap-plugin-facebook-connect/).

I've done some research and found the following reasons why this error could occur:

  • 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 (not sure if I have this right).

The following is the case:

  • The BundleIdentifier and BundleURLName match.
  • The app isn't in Sandbox mode.
  • The app doesn't appear in 'Allow These Apps To Use Your Account' of every user
  • The builders of the Phonegap plugin said to have fixed the iOS 6.0 permissions bug (https://github.com/davejohnson/phonegap-plugin-facebook-connect/pull/216)

It's a very inconsistent bug (in my case). I can only reproduce the error myself if I switch off the app in 'Allow These Apps To Use Your Account' (in my case the app is listed there), but I can easily fix the error by allowing the app again. At the moment most of the testers don't have this bug (anymore), but the error remains on an iPod (where the app isn't listed in 'Allow These Apps To Use Your Account' either).

Does anyone have any idea why I'm having this bug?

like image 634
saltandpepper Avatar asked Jan 04 '13 15:01

saltandpepper


People also ask

What is Facebook SDK iOS?

The Facebook SDK enables: Facebook Login - Authenticate people with their Facebook credentials. Share and Send dialogs - Enable sharing content from your app to Facebook. App Events - Log events in your application.

What is the latest version of Facebook SDK for iOS?

The current version of the Facebook SDK for iOS is version 14.1. 0.

How can I update my Facebook SDK?

Login into Facebook and navigate to https://developers.facebook.com/apps/ Select the App you want to upgrade (you might have access to multiple apps) Click Settings > Advanced. Select the latest version under the Upgrade API Version section for both “Upgrade All Calls” and “Upgrade Calls for App Roles”

What is a FB SDK?

The Facebook SDK is a set of software components that developers can include in their mobile app to understand how people use the app, run optimized marketing campaigns and enable Facebook login and social sharing. This course helps you understand the purpose of the Facebook SDK and App Events for Android and iOS.


1 Answers

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.

like image 86
saltandpepper Avatar answered Sep 27 '22 21:09

saltandpepper