ERROR is value of type 'AuthDataResult' has no member 'uid'?

后端 未结 1 582
清歌不尽
清歌不尽 2021-01-16 19:11

My codes error I do not know why its saying that \'uid\' has no member, also i don\'t know where AuthDataResult is coming from because i have never used this as an import or

相关标签:
1条回答
  • 2021-01-16 20:07

    The error you get is:

    Value of type AuthDataResult has no member uid

    If you look at the reference documentation for AuthDataResult, you'll see that this is correct: there is no uid in that class. The uid property exists in FIRUser, so you'll want to use:

    user?.user.uid
    

    Or to make it less confusing, give your current user variable a name that better matches what it is:

    Auth.auth().signIn(withEmail: email, password: password) { (authData, error ) in
        if error != nil{
            //create account
        } else {
    
            KeychainWrapper.standard.set((authData?.user.uid)!,
            forKey: ("Key_UID"))
            self.preformSegue(performSegue(withIdentifier: "toFeed", sender: nil))
        }
    }
    
    0 讨论(0)
提交回复
热议问题