Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failing to open active session after updating Facebook SDK to 3.5

Tags:

ios

facebook

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
like image 466
alexgophermix Avatar asked Apr 19 '13 21:04

alexgophermix


People also ask

What is the latest version of Facebook SDK for iOS?

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.

How do I add Facebook SDK framework to Xcode?

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.

What is Facebook SDK iOS?

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.


2 Answers

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.

like image 139
Lola Avatar answered Oct 27 '22 00:10

Lola


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>
like image 38
Sapozhnik Ivan Avatar answered Oct 27 '22 00:10

Sapozhnik Ivan