1

使用 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 更新?

4

1 回答 1

0

我正在使用带有ios 11的 FBSDK 版本 [ 4.17.0 ] ,它工作正常

  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
            {


            }
    })
于 2017-09-25T14:48:09.200 回答