Can't auth to Facebook with iOS SDK and native Facebook application

What I have and what're problems occurred:

  1. I've one Facebook account with game application (every day people's playing)
  2. I've one more Facebook account with test application, that created recently with default settings.
  3. I've native Facebook application on my iPod
  4. I'm developing iOS application which uses Facebook iOS SDK.

Invalid flow:

If I use App ID/API Key from first application, I open my application and trying to login. Facebook SDK opens native FB application and show me that screen

I press OK and go back to my iOS with such error and without access token:

(NSError *) $0 = 0x001710f0 Error Domain=com.facebook.sdk Code=2 "The operation couldn’t be completed. (com.facebook.sdk error 2.)" UserInfo=0x16d4b0 {com.facebook.sdk:ErrorLoginFailedOriginalErrorCode=210}

Valid flow:

If I use App ID/API Key from second (test) application, I open my application and trying to login. Facebook SDK opens native FB application and show me that screen

I press OK and go back to my iOS with valid access token.

Settings of applications are the same, I didn't see any differences. This problem occurred if I have native Facebook application. If I haven't it, Facebook SDK opens browser and authorization will be successful with first and second App ID.

If someone had such problem, please help. Thanks a lot.

Answers


I solved the issue.

Actually after changing here and there I found my bundle id was not matching. I have kept the bundle id same in the following 3 places and it worked:

  1. The bundle identifier of your project.
  2. In your FB a/c the filed named "iOS Bundle ID:" under head Native iOS App.
  3. The notification string value in your AppDelegate.m

    NSString *const FBSessionStateChangedNotification = @"yourbundleid:FBSessionStateChangedNotification";


I found that I received the same error when I requested the permission: "offline_access". When I stopped asking for this permission, the error went away.


I had the same problem, and my BundleId were both correct, on FB and in my project.

Check that your FB App is enabled in Settings -> Facebook. Mine was disabled (even though I don't remember disabling it) and once I enabled it, it was fixed.

In my test process, I've added and removed my FB App several times from my FB Account, which is linked with my iPhone. It may explain why, magically, my app was disabled.


Need Your Help

How to program a CAN-BUS arduino shield to control car windows?

arduino voice-recognition can-bus

My project is to control car windows using voice recognition. I have successfully controlled some LED's using the EasyVR arduino shield using and arduino MEGA. Now I want to take control of the win...

how to customize tab position in xamarin ios

c# ios tabs xamarin.ios

I have gone through with this link xamarin tabs link for applying the tabs in my xamarin IOS application. and tabs has been successfully applied but i need this tabs should appear on the top of the