I'm trying to detect when the facebook login viewcontroller gets dismissed so I can stop the loading animation. I implemented the facebook login SDK through firebase, and I'm logging in using this method:
@IBAction func facebookSignIn(_ sender: UIButton) {
loginBtn.startLoadingAnimation()
FBSDKLoginManager().logIn(withReadPermissions: ["email"], from: self) { (result, err) in
if err != nil {
print("CustomFB Login Failed: ", err)
self.loginBtn.stopLoadingAnimation()
return
}
}
}
How would I detect when the login viewcontroller gets dismissed?
This is simple, you have put stopLoadingAnimation()
in the wrong place.
@IBAction func facebookSignIn(_ sender: UIButton) {
loginBtn.startLoadingAnimation()
FBSDKLoginManager().logIn(withReadPermissions: ["email"], from: self) { (result, err) in
self.loginBtn.stopLoadingAnimation()
//Facebook login is complet after Two case, failer and success.
if err != nil {
print("CustomFB Login Failed: ", err)
return
}
}
}
Stop spinner login is under if condition, but user clicks on cancel then your spinner does not stop.
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.