最新版本的FirebaseAuth 5.0出现问题,这是我的代码:
if let email = emailField.text, let password = passwordField.text {
Auth.auth().signIn(withEmail: email, password: password) { (user, error) in
if error == nil {
if let user = user {
if self.segmentedControl.selectedSegmentIndex == 0 {
let userData = ["provider": user.providerID] as [String: Any]
问题是“类型'AuthDataResult'的值没有值“ ProviderID”“但在Firebase 4中,此方法有效。谢谢!
答案 0 :(得分:0)
AuthDataResult的属性用户具有providerID
。在AuthDataResult
中,您不应将user
视为completion
。您可以按以下方式访问providerId
,
if let email = emailField.text, let password = passwordField.text {
Auth.auth().signIn(withEmail: email, password: password) { (authData, error) in
if error == nil {
if let user = authData?.user {
if self.segmentedControl.selectedSegmentIndex == 0 {
let userData = ["provider": user.providerID] as [String: Any]