Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
417 views
in Technique[技术] by (71.8m points)

ios - Reset Facebook Token Reference - Facebook SDK 4.0

I previously used the following to clear and reset the Facebook access token

[FBSession.activeSession closeAndClearTokenInformation];

Since the update to 4.0 this no longer works. FBSession.activeSession has changed to [FBSDKAccessToken currentAccessToken].

I however can't find the latest version of closeAndClearTokenInformation that works with the latest version. Any suggestions?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
FBSDKLoginManager *logMeOut = [[FBSDKLoginManager alloc] init];
[logMeOut logOut];

or

[FBSDKAccessToken setCurrentAccessToken:nil];
[FBSDKProfile setCurrentProfile:nil];

to logout

Then when you login again, make sure to set:

login.loginBehavior = FBSDKLoginBehaviorWeb;

Like so:

FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
login.loginBehavior = FBSDKLoginBehaviorWeb;
[login logInWithReadPermissions:@[@"user_friends"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
         etc...
}];

I found some info in the docs saying FBSDKLoginBehaviorWeb can be used for "kiosk" apps; which I guess are apps designed to have more than one person log into them routinely.

One thing to note, this login method creates a modal UIWebView which is set up for portrait mode. I'm not sure if its possible to change this yet.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...