Exit iOS SDK for Facebook

I am using the official and updated Facebook iOS SDK .
We are developing an application on the iPad, which is used in a physical store using our own distribution profile. Where customers can log in to their Facebook account on the iPad, which is available to improve their shopping experience.

The problem I encountered is that when a user logs into their Facebook account, the next user (client) will still be logged in with the credentials of previous users ( You have already authorized xxx, Press "Okay" to continue ) . Of course, this is not normal.

Is there a way to actually log out (sign, clear credentials, or ever) of a previous (or current) user so that the next user can fill in their own username and password.

Unfortunately, [[FBSession activeSession] closeAndClearTokenInformation] doesn’t quite do the trick.

This is part of the code:

  // .... [[FBSession activeSession] closeAndClearTokenInformation]; [FBSession.activeSession openWithCompletionHandler:^(FBSession *session, FBSessionState state, NSError *error) { // More code ... }]; // ... 

PS. Cookie workaround doesn't work for me (obviously)

+6
source share
3 answers

From your context, I assume that your device (s) do not have a Facebook application installed, and you do not expect to use iOS 6 system authentication, which would leave the default login behavior for using Safari. If you need to clear Safari cookies, this should work, but for smoother use in your script, you should use the FBSession openWithBehavior:completionHandler: method and specify the FBSessionLoginBehaviorForcingWebview behavior FBSessionLoginBehaviorForcingWebview that it uses the built-in web view dialog for authentication.

See the SwitchUserSample section of the Facebook iOS SDK for an example, as this example demonstrates an application that can switch between multiple accounts.

+8
source

Try using this code. I think this will help you.

 FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init]; [login logOut]; 
0
source

If you are using facebook sdk 4.1.0 just call the following method

 if ([FBSDKAccessToken currentAccessToken]) { [FBSDKAccessToken setCurrentAccessToken:nil]; [FBSDKProfile setCurrentProfile:nil]; } 
0
source

All Articles