重置Facebook令牌参考 - Facebook SDK 4.0 [英] Reset Facebook Token Reference - Facebook SDK 4.0
问题描述
我之前使用以下内容清除并重置Facebook访问令牌
I previously used the following to clear and reset the Facebook access token
[FBSession.activeSession closeAndClearTokenInformation];
由于更新到4.0,因此不再有效。 FBSession.activeSession
已更改为 [FBSDKAccessToken currentAccessToken]
。
Since the update to 4.0 this no longer works. FBSession.activeSession
has changed to [FBSDKAccessToken currentAccessToken]
.
但是我无法找到最新版本的 closeAndClearTokenInformation 。有什么建议吗?
I however can't find the latest version of closeAndClearTokenInformation that works with the latest version. Any suggestions?
推荐答案
FBSDKLoginManager *logMeOut = [[FBSDKLoginManager alloc] init];
[logMeOut logOut];
或
[FBSDKAccessToken setCurrentAccessToken:nil];
[FBSDKProfile setCurrentProfile:nil];
退出
然后登录时再次确保设置:
Then when you login again, make sure to set:
login.loginBehavior = FBSDKLoginBehaviorWeb;
如下所示:
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
login.loginBehavior = FBSDKLoginBehaviorWeb;
[login logInWithReadPermissions:@[@"user_friends"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
etc...
}];
我在文档中发现了一些信息,说FBSDKLoginBehaviorWeb可以用于kiosk应用程序;我想这些应用程序的目的是让不止一个人定期登录。
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.
有一点需要注意,这个登录方法创建了一个为肖像设置的模态UIWebView模式。我不确定是否可以改变它。
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.
这篇关于重置Facebook令牌参考 - Facebook SDK 4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!