快速错误:使用无法解析的标识符“ authData”

时间:2019-06-27 21:25:05

标签: swift firebase firebase-authentication

我不知道为什么说'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)
                }
        })
    }
}

1 个答案:

答案 0 :(得分:0)

您正在进行类引用,也就是说,您希望类User具有一个静态属性user,而它不是

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

也许您是说您刚刚读过的uid

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