Lionel Tressens
Lionel Tressens

Reputation: 481

Facebook connect on iOS with SDK 3.5

I am developing an iOS app and switching to the new Facebook iOS SDK 3.5.1.

On iOS 6, using Facebook integration within the system, the login process of a user in my app works as expected, the completion handler block is called after the user granted the permissions.

The problem is when not using this integration, with or without the Facebook app installed.

When I call "openActiveSessionWithReadPermissions" the completion handler block is called immediately with FBSessionStateClosedLoginFailed state, then the user grants permissions to the application and when he gets back to the app, the completion handler is never called again, so I am not notified of the user login.

I have tried many changes, deleting the app from the list of allowed apps on my facebook user, uninstalling the app from the device, etc... but I have no clue about what is happening there...

Any help greatly appreciated !

Thanks community

Upvotes: 0

Views: 675

Answers (1)

Lionel Tressens
Lionel Tressens

Reputation: 481

Fix found ! Here it is for other in the same situation.

I was not correctly handling the switch back to my app, that's why the bug was only occurring when using the fast app switch (with Safari or Facebook app). Technically I was supposed to implement the two following methods in the application delegate :

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    [FBSession.activeSession handleDidBecomeActive];
}

and

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    return [FBSession.activeSession handleOpenURL:url];
}

Upvotes: 1

Related Questions