首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >FBSDKLoginManagerLoginResult返回零iOS 11

FBSDKLoginManagerLoginResult返回零iOS 11
EN

Stack Overflow用户
提问于 2017-09-25 08:22:14
回答 1查看 749关注 0票数 1

对于iOS 11 FBSDKLoginManager (v.4.25.0),使用SFAuthenticationSession而不是SFSafariViewController,如果用户取消登录,FBSDKLoginManagerLoginResult总是返回0和result.isCancelled代码不工作:

代码语言:javascript
运行
复制
[[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更新?

EN

回答 1

Stack Overflow用户

发布于 2017-09-25 14:48:09

我使用的是FBSDK版本的4.17.0ios 11,它工作得很好

代码语言:javascript
运行
复制
  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
            {


            }
    })
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46400603

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档