With iOS 11 FBSDKLoginManager (v.4.25.0) use SFAuthenticationSession instead of SFSafariViewController, if user cancel Sign In, FBSDKLoginManagerLoginResult always return nil and result.isCancelled code not work:
[[FBSDKLoginManager new] logInWithReadPermissions:@[PERMISSIONS]
fromViewController:self
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error) {
//Error happen
}
else if (result.isCancelled) {
//User cancel
}
else {
//Login success
}
}];
In this case always happen error with description 'com.apple.SafariServices.Authentication Code=1 "(null)"'. So, in this case, we can't discern really error from SFAuthenticationSession error. Any ideas how to handle different errors? Or just need to wait FBSDK update?
I'm using FBSDK version [ 4.17.0 ] with ios 11 and it works fine
let facebookLogin = FBSDKLoginManager()
facebookLogin.logOut()
facebookLogin.logIn(withReadPermissions: ["public_profile","email", "user_friends"], from:self, handler:
{
(facebookResult, facebookError) -> Void in
if facebookError != nil
{
print("Facebook login failed. Error \(String(describing: facebookError))")
}
else if (facebookResult?.isCancelled)!
{
print("Facebook login was cancelled.")
}
else
{
}
})
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.