gpt4 book ai didi

ios - Firebase -Auth.auth().currentUser?.phoneNumber 返回 nil

转载 作者:行者123 更新时间:2023-11-28 07:19:54 26 4
gpt4 key购买 nike

我使用以下方法验证并链接用户的电话号码:

let credential = PhoneAuthProvider.provider().credential(withVerificationID: verificationId, verificationCode: verificationCode)

Auth.auth().currentUser?.link(with: credential, completion: { [weak self](authDataResult, error) in
// no error then success
})

在 Firebase 控制台内,电话号码与用户的电子邮件相关联:

enter image description here

当我尝试使用下面的方法访问电话号码时,它显示为 nil

guard let userPhoneNumber = Auth.auth().currentUser?.phoneNumber else { return }

我刚刚更新了我的 pod,就出现了这个问题,之前没有发生过。

当前更新的 Podfile.lock:

  - Firebase/Auth (6.11.0):
- Firebase/CoreOnly
- FirebaseAuth (~> 6.3.1)
- Firebase/Core (6.11.0):
- Firebase/CoreOnly
- FirebaseAnalytics (= 6.1.3)
- Firebase/CoreOnly (6.11.0):
- FirebaseCore (= 6.3.2)
- Firebase/Database (6.11.0):
- Firebase/CoreOnly
- FirebaseDatabase (~> 6.1.1)
- FirebaseAnalyticsInterop (~> 1.3)
- FirebaseCore (~> 6.2)
- FirebaseInstanceID (4.2.6):
- FirebaseCore (~> 6.0)
- FirebaseMessaging (4.1.7):
- FirebaseAnalyticsInterop (~> 1.3)
- FirebaseCore (~> 6.2)
- FirebaseInstanceID (~> 4.1)
// ...

旧的 Podfile.lock

  - Firebase/Auth (6.8.1):
- Firebase/CoreOnly
- FirebaseAuth (~> 6.2.3)
- Firebase/Core (6.8.1):
- Firebase/CoreOnly
- FirebaseAnalytics (= 6.1.1)
- Firebase/CoreOnly (6.8.1):
- FirebaseCore (= 6.2.3)
- Firebase/Database (6.8.1):
- Firebase/CoreOnly
- FirebaseDatabase (~> 6.1.0)
- Firebase/DynamicLinks (6.8.1):
- Firebase/CoreOnly
- FirebaseDynamicLinks (~> 4.0.5)
- Firebase/Messaging (6.8.1):
- Firebase/CoreOnly
- FirebaseMessaging (~> 4.1.4)
- Firebase/Storage (6.8.1):
- Firebase/CoreOnly
- FirebaseStorage (~> 3.4.1)
- FirebaseAnalytics (6.1.1):
- FirebaseCore (~> 6.2)
- FirebaseInstanceID (~> 4.2)
- GoogleAppMeasurement (= 6.1.1)
- GoogleUtilities/AppDelegateSwizzler (~> 6.0)
- GoogleUtilities/MethodSwizzler (~> 6.0)
- GoogleUtilities/Network (~> 6.0)
- "GoogleUtilities/NSData+zlib (~> 6.0)"
- nanopb (~> 0.3)
- FirebaseAnalyticsInterop (1.4.0)
- FirebaseAuth (6.2.3):
- FirebaseAuthInterop (~> 1.0)
- FirebaseCore (~> 6.2)
- GoogleUtilities/AppDelegateSwizzler (~> 6.2)
- GoogleUtilities/Environment (~> 6.2)
- GTMSessionFetcher/Core (~> 1.1)
- FirebaseAuthInterop (1.0.0)
- FirebaseCore (6.2.3):
- FirebaseCoreDiagnostics (~> 1.0)
- FirebaseCoreDiagnosticsInterop (~> 1.0)
- GoogleUtilities/Environment (~> 6.2)
- GoogleUtilities/Logger (~> 6.2)
- FirebaseCoreDiagnostics (1.0.1):
- FirebaseCoreDiagnosticsInterop (~> 1.0)
- GoogleDataTransportCCTSupport (~> 1.0)
- GoogleUtilities/Environment (~> 6.2)
- GoogleUtilities/Logger (~> 6.2)
- FirebaseAnalyticsInterop (~> 1.3)
- FirebaseCore (~> 6.2)
- FirebaseInstanceID (~> 4.1)
- GoogleUtilities/AppDelegateSwizzler (~> 6.2)
- GoogleUtilities/Environment (~> 6.2)
- GoogleUtilities/Reachability (~> 6.2)
- GoogleUtilities/UserDefaults (~> 6.2)
- Protobuf (~> 3.1)
- FirebaseStorage (3.4.1):
- FirebaseAuthInterop (~> 1.0)
- FirebaseCore (~> 6.0)
- GTMSessionFetcher/Core (~> 1.1)

最佳答案

我不确定发生了什么,但我注销了,关闭了 Xcode,删除了模拟器,删除了派生数据,重新启动了我的 cpu,重新开始并重新登录。它现在可以工作了。

模拟器上一定存在某种损坏。如果有人遇到这个奇怪的问题,请按照上述步骤操作。

关于ios - Firebase -Auth.auth().currentUser?.phoneNumber 返回 nil,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58511403/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com