Unable to authenticate to Facebook using the iOS SDK and Facebook native app

What I have and what problems have arisen:

  • I have one Facebook account with a game application (every day people play)
  • I have another Facebook account with a test application recently created with default settings.
  • I have a Facebook application on an iPod.
  • I am developing an iOS application that uses the iOS SDK for iOS.

Invalid stream:

If I use the App ID / API key from the first application, I open the application and try to log in. The Facebook SDK opens its own FB application and shows me that the screen enter image description here

I click OK and return to my iOS with this error and without an 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 stream:

If I use the App ID / API Key from the second (test) application, I open the application and try to log in. The Facebook SDK opens its own FB application and shows me that the screen enter image description here

I click OK and return to my iOS with a valid access token.

Application settings are the same, I do not see the differences. This problem occurred if I have my own Facebook application. If I do not have this, the Facebook SDK will open a browser and authorization will be successful with the first and second application identifier.

If anyone had such a problem, please help. Many thanks.

+6
source share
3 answers

I solved the problem.

Actually, after changing here and there, I found that the packet identifier does not match. I saved the package identifier in the following three places and it worked:

  • Package ID of your project.
  • Your FB a / c is named "iOS Bundle ID:" under the heading of the Native iOS App.
  • The value of the notification line in the AppDelegate.m application

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

+16
source

I found that I received the same error when requesting permission: "offline_access". When I stopped asking for permission, the error disappeared.

+4
source

I had the same problem and my BundleId was right on FB and in my project.

Make sure your FB application is enabled in Settings → Facebook. The mine was turned off (although I do not remember turning it off), and as soon as I turned it on, it was fixed.

In my test process, I added and removed my FB application several times from my FB account, which is associated with my iPhone. This may explain why, by magic, my application was disconnected.

+2
source

Source: https://habr.com/ru/post/923024/


All Articles