<small id='GWm0C'></small><noframes id='GWm0C'>

<i id='GWm0C'><tr id='GWm0C'><dt id='GWm0C'><q id='GWm0C'><span id='GWm0C'><b id='GWm0C'><form id='GWm0C'><ins id='GWm0C'></ins><ul id='GWm0C'></ul><sub id='GWm0C'></sub></form><legend id='GWm0C'></legend><bdo id='GWm0C'><pre id='GWm0C'><center id='GWm0C'></center></pre></bdo></b><th id='GWm0C'></th></span></q></dt></tr></i><div id='GWm0C'><tfoot id='GWm0C'></tfoot><dl id='GWm0C'><fieldset id='GWm0C'></fieldset></dl></div>
<tfoot id='GWm0C'></tfoot>
      • <bdo id='GWm0C'></bdo><ul id='GWm0C'></ul>
    1. <legend id='GWm0C'><style id='GWm0C'><dir id='GWm0C'><q id='GWm0C'></q></dir></style></legend>

        Firebase Phone 身份验证无法接收远程通知注册

        时间:2023-07-29

      1. <tfoot id='6wJq6'></tfoot><legend id='6wJq6'><style id='6wJq6'><dir id='6wJq6'><q id='6wJq6'></q></dir></style></legend>
      2. <i id='6wJq6'><tr id='6wJq6'><dt id='6wJq6'><q id='6wJq6'><span id='6wJq6'><b id='6wJq6'><form id='6wJq6'><ins id='6wJq6'></ins><ul id='6wJq6'></ul><sub id='6wJq6'></sub></form><legend id='6wJq6'></legend><bdo id='6wJq6'><pre id='6wJq6'><center id='6wJq6'></center></pre></bdo></b><th id='6wJq6'></th></span></q></dt></tr></i><div id='6wJq6'><tfoot id='6wJq6'></tfoot><dl id='6wJq6'><fieldset id='6wJq6'></fieldset></dl></div>

              <bdo id='6wJq6'></bdo><ul id='6wJq6'></ul>

                  <tbody id='6wJq6'></tbody>
                • <small id='6wJq6'></small><noframes id='6wJq6'>

                  本文介绍了Firebase Phone 身份验证无法接收远程通知注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  目前正在努力解决日志中显示的以下错误:

                  Currently struggling with the following error showing up in logs:

                  <代码><错误>[Firebase/Auth][I-AUT000015] UIApplicationDelegate 必须处理远程通知才能进行电话号码身份验证.

                  以及调用 verifyPhoneNumber:completion: 时的这个 NSError 对象:

                  as well as this NSError object when calling verifyPhoneNumber:completion: :

                  @"NSLocalizedDescription" : @"如果禁用了app delegate swizzling,UIApplicationDelegate收到的远程通知需要转发到FIRAuth的canHandleNotificaton:方法."@"error_name" : @"ERROR_NOTIFICATION_NOT_FORWARDED"

                  有人知道这是怎么回事以及如何解决吗?

                  我正在使用 XCode 8.3.3、Firebase 4.0.0,我已经关闭了 swizzling,并且我已经确认我成功注册了 APNS(我看到了令牌)和 FCM(我也看到了这个).

                  I am using XCode 8.3.3, Firebase 4.0.0, I've switched OFF swizzling, and I already confirmed that I successfully register both for APNS (I see the token) and for FCM (I see this as well).

                  我在文档和 iOS 云消息 github 示例 repo 中都使用了示例代码.

                  I used the sample code both in documentation and in the iOS cloud message github sample repo.

                  在尝试将 Firebase 集成到同一个项目中之前,我让 Digits 电话身份验证工作完美无缺,并且推送通知来自 AWS SNS 和 OneSignal.

                  Before trying to integrate Firebase in the same project, I had Digits phone auth working flawlessly, and push notifications coming in both from AWS SNS and OneSignal.

                  Firebase 相关部分的相关代码:

                  Relevant code for Firebase-related parts:

                  AppDelegate

                  AppDelegate

                  + (void)initialize
                  {
                  
                      FIROptions *firOptions = [[FIROptions alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"some-plist-name" ofType:@"plist"]];
                      [FIRApp configureWithOptions:firOptions];
                  }
                  
                  
                  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
                  
                      [FIRMessaging messaging].delegate = self;
                      [FIRMessaging messaging].shouldEstablishDirectChannel = YES;
                  
                      [UNUserNotificationCenter currentNotificationCenter].delegate = self;
                  
                      // do some other setup stuff here ...
                  
                      return YES;
                  }
                  
                  #pragma mark - FIRMessagingDelegate
                  
                  - (void)messaging:(nonnull FIRMessaging *)messaging didRefreshRegistrationToken:(nonnull NSString *)fcmToken {
                  
                      // I get an fcmToken here as expected and notify the the relevant controller(s)
                  
                  }
                  
                  - (void)messaging:(nonnull FIRMessaging *)messaging didReceiveMessage:(nonnull FIRMessagingRemoteMessage *)remoteMessage {
                  
                  }
                  
                  #pragma mark - UNUserNotificationCenterDelegate
                  
                  - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
                      NSDictionary *userInfo = notification.request.content.userInfo;
                      [[FIRAuth auth] canHandleNotification:userInfo];
                  
                      completionHandler(UNNotificationPresentationOptionNone);
                  }
                  
                  - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler {  
                      completionHandler();
                  }
                  
                  #pragma mark - Notifications
                  
                  - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
                  
                      FIRMessagingAPNSTokenType tokenType = FIRMessagingAPNSTokenTypeProd;
                  #if DEBUG && !TESTFLIGHT
                      tokenType = FIRMessagingAPNSTokenTypeSandbox;
                  #endif
                  
                      [[FIRMessaging messaging] setAPNSToken:deviceToken type:tokenType];
                  
                  }
                  
                  - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error {
                  
                  }
                  
                  - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
                  
                      [[FIRAuth auth] canHandleNotification:userInfo];
                  
                      completionHandler(UIBackgroundFetchResultNewData);
                  }
                  
                  - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
                  
                      [[FIRAuth auth] canHandleNotification:userInfo];
                  
                  }
                  
                  - (void)application:(UIApplication *) application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)notification completionHandler:(void (^)())completionHandler {
                  
                      completionHandler();
                  
                  }
                  
                  
                  @end
                  

                  控制器 1

                  ...
                  
                  UNAuthorizationOptions authOptions = UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge;
                  [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:authOptions completionHandler:^(BOOL granted, NSError * _Nullable error) {
                  
                  }];
                  
                  [[UIApplication sharedApplication] registerForRemoteNotifications];
                  
                  ...
                  

                  控制器 2 - 在收到 APNS 和 FCM OK 后

                  Controller 2 - after receiving APNS and FCM OK

                  ...
                  
                  [[FIRPhoneAuthProvider provider] verifyPhoneNumber:@"+11111111"
                                                          completion:^(NSString * _Nullable verificationID, NSError * _Nullable error) {
                      // Here is where I get that error.
                  }];
                  ...
                  

                  推荐答案

                  你错过了在你的 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)
                  }
                  

                  这篇关于Firebase Phone 身份验证无法接收远程通知注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在没有用户点击通知的情况下处理数据负载? 下一篇:使用 Google API 接收到 Firebase 主题消息的状态

                  相关文章

                    <bdo id='vuZPw'></bdo><ul id='vuZPw'></ul>

                  1. <small id='vuZPw'></small><noframes id='vuZPw'>

                  2. <tfoot id='vuZPw'></tfoot>
                    <i id='vuZPw'><tr id='vuZPw'><dt id='vuZPw'><q id='vuZPw'><span id='vuZPw'><b id='vuZPw'><form id='vuZPw'><ins id='vuZPw'></ins><ul id='vuZPw'></ul><sub id='vuZPw'></sub></form><legend id='vuZPw'></legend><bdo id='vuZPw'><pre id='vuZPw'><center id='vuZPw'></center></pre></bdo></b><th id='vuZPw'></th></span></q></dt></tr></i><div id='vuZPw'><tfoot id='vuZPw'></tfoot><dl id='vuZPw'><fieldset id='vuZPw'></fieldset></dl></div>
                  3. <legend id='vuZPw'><style id='vuZPw'><dir id='vuZPw'><q id='vuZPw'></q></dir></style></legend>