对于iOS 11 FBSDKLoginManager (v.4.25.0),使用SFAuthenticationSession而不是SFSafariViewController,如果用户取消登录,FBSDKLoginManagerLoginResult总是返回0和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更新?
发布于 2017-09-25 14:48:09
我使用的是FBSDK版本的4.17.0和ios 11,它工作得很好
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
{
}
})
https://stackoverflow.com/questions/46400603
复制相似问题