I'm currently using Facebook as a login in for my users to sign. When my users have to sign out I have a custom button made calling a sign out method that I made. When the user is signed out and go back to login screen the Facebook button still say logout when it should say login.
//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)
}
Just call logOut()
from FBSDKLoginManager
Logs the user out
This calls [FBSDKAccessToken setCurrentAccessToken:nil] and [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)
}
Don't forget to add import FBSDKLoginKit
at the class where you use it
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.