我正在尝试为iOS应用实现Phone-Auth。
我从error.localizedDescription中得到了错误:令牌不匹配。
这是什么意思? “令牌不匹配”对我无语...
我也收到此错误:“此虚假通知应转发到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)
}
答案 0 :(得分:0)
我解决了这个问题,启用电话身份验证后,我们必须再次下载GoogleService-Info.plist以覆盖旧的