Facebook未在iOS 9中的didCompleteWithResult中返回数据 [英] Facebook is not returning data in didCompleteWithResult in iOS 9

查看:113
本文介绍了Facebook未在iOS 9中的didCompleteWithResult中返回数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现Facebook登录,它在iOS 8.4上运行良好,并且在iOS 9.1上运行良好,但是今天早上我发现它存在问题.

I am trying to implement Facebook login, it's working good for iOS 8.4 and it was working good for iOS 9.1 as well however today morning I found it faulty.

在委托函数下方未返回任何内容,因此应用程序在测试设备中关闭

It's returning nothing in below delegate function so app closes in testing device

func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!)
{
NSLog("Here")
if let b = result
    {
    if ((error) != nil)
    {
        FBSDKLoginManager().logOut()
        JLToast.makeText("Facebook login error").show()
    }
    else if result.isCancelled {

        self.fbloginButton.enabled = false
        FBSDKLoginManager().logOut()
        FBSDKAccessToken.setCurrentAccessToken(nil)
        JLToast.makeText("You have cancelled facebook login").show()
        self.dismissViewControllerAnimated(true, completion: nil)
    }
    else {
        // If you ask for multiple permissions at once, you
        // should check if specific permissions missing
        if(result != nil)
        {
        if result.grantedPermissions.contains("email")
        {
            self.fbloginButton.enabled = false
            self.getFBUserData()
            //self.getFBUserDataWithoutEmail()
        }
        else
        {
            self.fbloginButton.enabled = false
            JLToast.makeText("Your email address has not been recovered from facebook account. Please provide it.")
            self.getFBUserDataWithoutEmail()
        }
        }
        else
        {
            JLToast.makeText("No Data.")
        }
    }
    }
    else
    {

    }
}

我正在检查其此处"的日志记录,但操作不进一步,正在关闭该应用程序.

I am checking its logging "here" however its not going further, its closing the app.

N:B:它正在iOS 9的SafariViewController中打开.

N:B: it's opening in SafariViewController in iOS 9.

推荐答案

您是否遵循了ios 9的本教程?

Did you follow this tutorial for ios 9?

https://developers.facebook.com/docs/ios/ios9

我相信这就是您遇到问题的原因.

I believe this is why you have problems.

这篇关于Facebook未在iOS 9中的didCompleteWithResult中返回数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆