【问题标题】:swift ERROR: Use of unresolved identifier 'authData'快速错误:使用未解析的标识符“authData”
【发布时间】:2019-06-27 21:25:05
【问题描述】:

我不知道为什么它说'uid'没有成员。

类型“用户”没有成员“用户”

我的代码:

@IBAction func signIn (_ sender: AnyObject) {

    if let email = emailField.text, let password = passwordField.text {
        Auth.auth().signIn(withEmail: email, password: password, completion: { (authDataResult: AuthDataResult?, error) in

                if error == nil {

                    self.userUid = authDataResult?.user.uid

                    KeychainWrapper.standard.set((User.user.uid)!, forKey: "uid")

                    self.performSegue(withIdentifier: "toMessages", sender: nil)
                } else {

                    self.performSegue(withIdentifier: "toSignUp", sender: nil)
                }
        })
    }
}

【问题讨论】:

    标签: swift firebase firebase-authentication


    【解决方案1】:

    您正在创建一个类引用,也就是说,您希望类 User 有一个静态属性 user,但它没有

    KeychainWrapper.standard.set((User.user.uid)!, forKey: "uid")
    

    也许你的意思是你刚刚读到的uid

    KeychainWrapper.standard.set(self.userUid!, forKey: "uid")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多