使用 iOS 11 FBSDKLoginManager (v.4.25.0) 使用 SFAuthenticationSession 而不是 SFSafariViewController,如果用户取消登录,FBSDKLoginManagerLoginResult 总是返回 nil 并且 result.isCancelled 代码不起作用:
[[FBSDKLoginManager new] logInWithReadPermissions:@[PERMISSIONS]
fromViewController:self
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error) {
//Error happen
}
else if (result.isCancelled) {
//User cancel
}
else {
//Login success
}
}];
在这种情况下,总是会发生错误,描述为 'com.apple.SafariServices.Authentication Code=1 "(null)"'。因此,在这种情况下,我们无法从 SFAuthenticationSession 错误中辨别出真正的错误。任何想法如何处理不同的错误?还是只需要等待 FBSDK 更新?