我正在尝试为iOS应用实现Phone-Auth。
我收到来自error.localizedDescription的错误: token 不匹配。
这是什么意思? “ token 不匹配”对我无语...
另外,我收到此错误:“此虚假通知应转发到Firebase Auth。”
码:
PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumber, uiDelegate: nil) { (verificationID, error) in
if let error = error {
print(error.localizedDescription)
return
}
// Sign in using the verificationID and the code sent to the user
// ...
AppDelegate:
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let firebaseAuth = Auth.auth()
firebaseAuth.setAPNSToken(deviceToken, type: AuthAPNSTokenType.prod)
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let firebaseAuth = Auth.auth()
if (firebaseAuth.canHandleNotification(userInfo)){
print(userInfo)
return
}
// Print full message.
print(userInfo)
completionHandler(UIBackgroundFetchResult.newData)
}
最佳答案
我解决了问题,启用电话身份验证后,我们必须再次下载GoogleService-Info.plist以覆盖旧的
关于ios - 模拟器FirebaseAuth可以使用!但不是物理设备。错误“ token 不匹配”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56724802/