PhoneAuthProvider在iOS 16.1模拟器突发报错,真机运行正常
iOS 16.1模拟器Firebase手机号验证失败(Token mismatch)
毫无征兆地,PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumber, uiDelegate: nil) 方法在我的iOS 16.1模拟器上开始执行失败,但在真机上仍可正常运行(使用同一构建版本)。我已尝试使用真实手机号和测试手机号进行测试。
环境信息
- Firebase SDK版本:
9.6.0 - 运行环境:iOS 16.1模拟器
错误信息
Error Domain=FIRAuthErrorDomain Code=17048 "Token mismatch" UserInfo={NSLocalizedDescription=Token mismatch, FIRAuthErrorUserInfoNameKey=INVALID_APP_CREDENTIAL}
AppDelegate相关代码
extension AppDelegate: UNUserNotificationCenterDelegate { func userNotificationCenter( _ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void ) { let userInfo = response.notification.request.content.userInfo completionHandler() } func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { Auth.auth().setAPNSToken(deviceToken, type: .unknown) Messaging.messaging().apnsToken = deviceToken } func application(_ application: UIApplication, didReceiveRemoteNotification notification: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { Messaging.messaging().appDidReceiveMessage(notification) if (Auth.auth().canHandleNotification(notification)) { completionHandler(.noData) return } } } extension AppDelegate: MessagingDelegate { func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) { let tokenDict = ["token": fcmToken ?? ""] NotificationCenter.default.post( name: Notification.Name("FCMToken"), object: nil, userInfo: tokenDict) } }
Firebase证书配置

补充说明
- 昨天将macOS更新到
13.0.1,这会不会是导致问题的原因? - 该功能在iOS 15模拟器上仍可正常运行。
请问各位有什么解决思路吗?
内容的提问来源于stack exchange,提问作者Sotiris Kaniras
相关产品推荐
相关产品推荐

