Can someone help me about this issue? The first error was \"value of type \'authdataresult\' has no member \'uid\'\".
Auth.auth()?.signIn(withEmail: email, p
The new Auth.auth().signIn and Auth.auth().createUser methods use a datatype of AuthDataResult? instead of User?
The old callback was user of type: User?
Auth.auth().signIn(withEmail: email, password: password, completion: { (user: User?, error) in
You would access properties directly on the callback user object such as:
if error == nil {
if let user = user {
self.userUid = user.uid
// user.email for the email address in firebase
}
}
The new callback is authDataResult of type: AuthDataResult?
Auth.auth().signIn(withEmail: email, password: password, completion: { (authDataResult: AuthDataResult?, error) in
Now you access properties directly on the callback authDataResult object such as:
if error == nil {
if let authDataResult = authDataResult {
self.userUid = authDataResult.user.uid
// authDataResult.user.email for the email address in firebase
}
}
Basically the user object from the old way is now a property on the authDataResult object and you can get the uid through there:
authDataResult.user.uid
Firebase's info about AuthDataResult