答案 0 :(得分:3)
将其更改为:
FIRAuth.auth()?.signInAnonymously(completion: { (anonymousUser, error) in
if error == nil{
print("UserId : \(anonymousUser?.uid)")
}else{
print(error?.localizedDescription)
}
})
注意:您可以将if语句更改为:
FIRAuth.auth()?.signInAnonymously(completion: { (anonymousUser, error) in
if let err = error{
print(err.localizedDescription)
return
}
print("UserId : \(anonymousUser?.uid)")
})
为了保存其他内容并使代码更具可读性。