【问题标题】:Unable to pass Facebook User properties to Firebase FIRAuth in Swift 3无法在 Swift 3 中将 Facebook 用户属性传递给 Firebase FIRAuth
【发布时间】:2016-10-01 00:31:52
【问题描述】:

我正在使用以下函数通过 Facebook 令牌和 Firebase FIRAuth 函数登录用户。 email 属性没有错误,也没有打印。好像该函数不会被调用。

var login = FBSDKLoginManager()

@IBOutlet weak var fbBtnPressed: UIButton!

@IBAction func fbBtnPressed(_ sender: AnyObject) {

    login.logIn(withReadPermissions: ["public_profile", "email", "user_friends"], from: self) { (FBSDKLoginManagerLoginResult, Error) in

        if Error != nil {
            print("The login with Facebook don't working. Erro: \(Error)")
        } else {
            let accessToken = FBSDKAccessToken.current().tokenString
            print("Login with Facebook ok. \(accessToken)")                

            let credential = FIRFacebookAuthProvider.credential(withAccessToken: FBSDKAccessToken.current().tokenString)

            FIRAuth.auth()?.signIn(with: credential) { (email, error) in

                if (error != nil) {
                    print("The login in the Firebase broke \(error)")
                } else {
                    print("Login in the Firebase ok \(email)")   
                }   
            }   
        }   
    }       
}

【问题讨论】:

  • “不起作用”并不是很有帮助.. DUDE!怎么了?将执行什么打印?后端会发生什么?屏幕上会发生什么?控制台会发生什么?您是否真的希望通过发布一些代码来获得帮助(到目前为止看起来还不错)?
  • @DavidSeek 显示朋友时不会出错。就像 FIRAuth.auth()?.signIn 只是不执行
  • 会:print("Login with Facebook ok. \(accessToken)") 被处决吗?
  • print("Login in the Firebase ok \(email)") 会被执行吗?
  • @DavidSeek 刚刚执行了“accessToken”。它返回访问密钥的值

标签: swift xcode facebook firebase fbsdkloginkit


【解决方案1】:

经过大量研究,似乎是 Swift3 结合 Keychain swap 的变化。

您必须在您的项目中启用 Keychange Sharing 功能。

【讨论】:

  • 我最后一个可以帮助您的选择是,如果您可以使用相同的设置设置一个简单的测试项目,然后给我发送一个 github 链接,以便我查看它。
  • 你不会相信的,我又添加了框架 Bolts.framework、FBSDKCoreKit.framework 和 FBSDKLoginKit.framework,而且很简单
猜你喜欢
  • 2016-11-12
  • 1970-01-01
  • 2020-04-30
  • 2017-08-20
  • 2023-04-03
  • 2011-12-21
  • 2013-05-18
  • 2017-02-03
  • 2016-09-17
相关资源
最近更新 更多