![](/img/trans.png)
[英]Firebase Phone Auth verificationId never being set. (Flutter iOS)
[英]Failing to implement Firebase Phone Auth on iOS
嘿,所以我有一個功能Firebase / iOS應用程序,正在嘗試實現電話身份驗證。
調用此方法
PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumber, uiDelegate: nil) { (verificationID, error) in if let error = error { self.showMessagePrompt(error.localizedDescription) return } // Sign in using the verificationID and the code sent to the user // ... }
在視圖控制器中傳遞有效數字。
我收到此錯誤->
UIApplicationDelegate必須處理遠程通知,電話號碼身份驗證才能正常工作。
錯誤域= FIRAuthErrorDomain代碼= 17054“如果禁用了應用程序委托混亂,則UIApplicationDelegate收到的遠程通知需要轉發到FIRAuth的canHandleNotificaton:方法。” UserInfo = {NSLocalizedDescription =如果禁用了應用程序委托混亂,則需要將UIApplicationDelegate收到的遠程通知轉發到FIRAuth的canHandleNotificaton:方法。,error_name = ERROR_NOTIFICATION_NOT_FORWARDED}
不是我不知道打Sw 。 委托沒有太多進展,但是本演練https://firebase.google.com/docs/auth/ios/phone-auth並未提及。
我沒有收到假設的靜默通知,也沒有收到短信。
謝謝。
請在您的AppDelegate
添加以下代碼:
func application(_ application: UIApplication,
didReceiveRemoteNotification notification: [AnyHashable : Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
if Auth.auth().canHandleNotification(notification) {
completionHandler(.noData)
return
}
// This notification is not auth related, developer should handle it.
handleNotification(notification)
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.