我目前正在使用Facebook登录,以便我的用户签名。当我的用户必须退出时,我有一个自定义按钮调用我做出的退出方法。当用户退出并返回登录屏幕时,Facebook按钮仍然会在登录时说出注销。
//my facebook button
lazy var facebookLogin:FBSDKLoginButton = {
let v = FBSDKLoginButton()
v.translatesAutoresizingMaskIntoConstraints = false
return v
}()
// my signout method
let firebaseAuth = FIRAuth.auth()
do {
try firebaseAuth?.signOut()
} catch let signOutError as NSError {
print ("Error signing out: %@", signOutError)
}
答案 0 :(得分:5)
只需从logOut()
FBSDKLoginManager
即可
将用户注销
这调用[FBSDKAccessToken setCurrentAccessToken:nil]和[FBSDKProfile setCurrentProfile:nil]。
// my signout method
let firebaseAuth = FIRAuth.auth()
do {
try firebaseAuth?.signOut()
FBSDKLoginManager().logOut()
} catch let signOutError as NSError {
print ("Error signing out: %@", signOutError)
}
不要忘记在您使用它的班级添加import FBSDKLoginKit