繁体   English   中英

无法在iOS上实施Firebase Phone Auth

[英]Failing to implement Firebase Phone Auth on iOS

嘿,所以我有一个功能Firebase / iOS应用程序,正在尝试实现电话身份验证。

  • 吊舱已安装
  • APNs身份验证密钥已上传到Firebase
  • 在Xcode中启用了推送通知
  • 调用此方法

    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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM