[英]Failing to implement Firebase Phone Auth on iOS
hey so I have a function Firebase/iOS app and am trying to implement phone auth. 嘿,所以我有一个功能Firebase / iOS应用程序,正在尝试实现电话身份验证。
calling this method 调用此方法
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 // ... }
in the view controller and passing a valid number. 在视图控制器中传递有效数字。
I get this error -> 我收到此错误->
The UIApplicationDelegate must handle remote notification for phone number authentication to work.
UIApplicationDelegate必须处理远程通知,电话号码身份验证才能正常工作。
Error Domain=FIRAuthErrorDomain Code=17054 "If app delegate swizzling is disabled, remote notifications received by UIApplicationDelegate need to be forwarded to FIRAuth's canHandleNotificaton: method."
错误域= FIRAuthErrorDomain代码= 17054“如果禁用了应用程序委托混乱,则UIApplicationDelegate收到的远程通知需要转发到FIRAuth的canHandleNotificaton:方法。” UserInfo={NSLocalizedDescription=If app delegate swizzling is disabled, remote notifications received by UIApplicationDelegate need to be forwarded to FIRAuth's canHandleNotificaton: method., error_name=ERROR_NOTIFICATION_NOT_FORWARDED}
UserInfo = {NSLocalizedDescription =如果禁用了应用程序委托混乱,则需要将UIApplicationDelegate收到的远程通知转发到FIRAuth的canHandleNotificaton:方法。,error_name = ERROR_NOTIFICATION_NOT_FORWARDED}
Swizzling is not disabled not that I know of. 不是我不知道打Sw 。 Delegate doesn't have much goin on but this walkthrough https://firebase.google.com/docs/auth/ios/phone-auth didn't mention it.
委托没有太多进展,但是本演练https://firebase.google.com/docs/auth/ios/phone-auth并未提及。
I'm not getting the silent notification I assume and def not receiving an SMS. 我没有收到假设的静默通知,也没有收到短信。
Thanks. 谢谢。
Please add following code in your AppDelegate
: 请在您的
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.