答案 0 :(得分:0)
使用以下代码
[FBSession.activeSession closeAndClearTokenInformation];
[FBSession setActiveSession:nil];
答案 1 :(得分:0)
有另一个解决方案。像这样更改loginManager的登录行为
let loginManager = LoginManager()
loginManager.loginBehavior = .browser
每次用户退出时,都会打开webview提示输入用户名和密码。
然后使用代码
登录用户loginManager.logIn(readPermissions: [.publicProfile, .email], viewController: self, completion: { (loginResult) in
switch loginResult {
case .failed(let error):
print(error)
case .cancelled:
print("User cancelled login.")
case .success(let grantedPermissions, let declinedPermissions, let accessToken):
print(grantedPermissions)
print(declinedPermissions)
print(accessToken)
print("Logged in!")
}
})
答案 2 :(得分:0)
试试这个
FBSDKLoginManager *login; //Global object for same class
login = [[FBSDKLoginManager alloc] init]; //when tap on login with Facebook
// for logout
[FBSDKAccessToken setCurrentAccessToken:nil];
[FBSDKProfile setCurrentProfile:nil];
[login logOut];