Reputation: 23
I'm getting an error from this code. Is there any way anyone could fix this problem?
Upvotes: 2
Views: 156
Reputation: 9356
change it to this:
FIRAuth.auth()?.signInAnonymously(completion: { (anonymousUser, error) in
if error == nil{
print("UserId : \(anonymousUser?.uid)")
}else{
print(error?.localizedDescription)
}
})
Note: You could change your if statement to something like:
FIRAuth.auth()?.signInAnonymously(completion: { (anonymousUser, error) in
if let err = error{
print(err.localizedDescription)
return
}
print("UserId : \(anonymousUser?.uid)")
})
To save you an else and make your code more readable.
Upvotes: 3