类型'String'的值没有成员'uid'

时间:2018-08-28 19:02:57

标签: firebase swift4

在下面的代码中,类型'String'的值没有成员'uid'

var userID: String!

if let email = emailField.text, let password = passwordField.text {
    Auth.auth().signIn(withEmail: email, password: password) { (authData, error)

        in
        if error != nil {
            //create account
        } else {
            if let userID = userID?.uid {
                KeychainWrapper.standard.set((userID)!, forKey: ("uid"))
                self.performSegue(withIdentifier: "toFeed", sender: nil)
            }
        }
    }
}

1 个答案:

答案 0 :(得分:0)

我认为您正在这样做:

if let userID = authData?.user.uid {