After updating the Facebook sdk to 3.5, when trying to perform openActiveSessionWithReadPermissions the operation fails. Here is the snippet for opening the session and handling the callback:
[FBSession openActiveSessionWithReadPermissions:@[@"email", @"user_hometown", @"user_location", @"user_birthday"]
allowLoginUI:YES
completionHandler:
^(FBSession *session,
FBSessionState state, NSError *error) {
switch (state) {
case FBSessionStateCreatedTokenLoaded:
case FBSessionStateOpenTokenExtended:
case FBSessionStateOpen:
{
completion(TRUE);
break;
}
case FBSessionStateClosed:
case FBSessionStateClosedLoginFailed:
completion(FALSE);
[FBSession.activeSession closeAndClearTokenInformation];
break;
default:
break;
}
}];
I end up in the FBSessionStateClosedLoginFailed case and I get a FBSKLog as follows:
FBSDKLog: Cannot use the Facebook app or Safari to authorize, fb123456789012345 is not registered as a URL Scheme
The current version of the Facebook SDK for iOS is version 14.1. 0. Code and samples for the Facebook SDK for iOS are available on GitHub.
In Xcode, click File > Swift Packages > Add Package Dependency. In the dialog that appears, enter the repository URL: https://github.com/facebook/facebook-ios-sdk. In Version, select Up to Next Major and the default option. Complete the prompts to select the libraries you want to use in your project.
The Facebook SDK is what allows mobile app developers to integrate Facebook within a mobile app. SDK stands for software development kit, and it allows for a website or app to integrate with Facebook seamlessly. Examples of what you can do with Facebook SDK include: Facebook Login functionality.
I Had the same problem (Facebook SDK 3.5.1)
My URL scheme for Facebook was on Item 1 in the Info.plist URL schemes. Problem fixed by moving it to Item 0.
I had the same problem. The code above fixed this issue. U have to edit your .plist file with text editor. But in Xcode u will not see any changes. Instead of URL Types - CFBundleURLTypes and instead of URL Schemes should be CFBundleURLSchemes.
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb48524**********</string>
</array>
</dict>
</array>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With