我不知道为什么说'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)
}
})
}
}
答案 0 :(得分:0)
您正在进行类引用,也就是说,您希望类User
具有一个静态属性user
,而它不是
KeychainWrapper.standard.set((User.user.uid)!, forKey: "uid")
也许您是说您刚刚读过的uid
KeychainWrapper.standard.set(self.userUid!, forKey: "uid")