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

    <tfoot id='TLuvs'></tfoot>
  1. <small id='TLuvs'></small><noframes id='TLuvs'>

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

  3. <legend id='TLuvs'><style id='TLuvs'><dir id='TLuvs'><q id='TLuvs'></q></dir></style></legend>

      Firebase 收到推送通知时未收到弹出窗口

      时间:2023-07-29
    1. <small id='G2Tjb'></small><noframes id='G2Tjb'>

              • <bdo id='G2Tjb'></bdo><ul id='G2Tjb'></ul>

              • <i id='G2Tjb'><tr id='G2Tjb'><dt id='G2Tjb'><q id='G2Tjb'><span id='G2Tjb'><b id='G2Tjb'><form id='G2Tjb'><ins id='G2Tjb'></ins><ul id='G2Tjb'></ul><sub id='G2Tjb'></sub></form><legend id='G2Tjb'></legend><bdo id='G2Tjb'><pre id='G2Tjb'><center id='G2Tjb'></center></pre></bdo></b><th id='G2Tjb'></th></span></q></dt></tr></i><div id='G2Tjb'><tfoot id='G2Tjb'></tfoot><dl id='G2Tjb'><fieldset id='G2Tjb'></fieldset></dl></div>
                <tfoot id='G2Tjb'></tfoot>
                  <tbody id='G2Tjb'></tbody>

                <legend id='G2Tjb'><style id='G2Tjb'><dir id='G2Tjb'><q id='G2Tjb'></q></dir></style></legend>

                本文介绍了Firebase 收到推送通知时未收到弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                import Firebase
                import FirebaseInstanceID
                import FirebaseMessaging
                func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
                
                    registerForPushNotifications(application)
                    FIRApp.configure()
                
                    // Add observer for InstanceID token refresh callback.
                    NSNotificationCenter
                     .defaultCenter()
                     .addObserver(self, selector: #selector(AppDelegate.tokenRefreshNotificaiton),
                                                                     name: kFIRInstanceIDTokenRefreshNotification, object: nil)
                
                    // Override point for customization after application launch.
                    return true
                  }
                
                func registerForPushNotifications(application: UIApplication) {
                      let settings: UIUserNotificationSettings =
                        UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil)
                      application.registerUserNotificationSettings(settings)
                      application.registerForRemoteNotifications()
                  }
                
                
                  func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject],
                                   fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
                    print("===== didReceiveRemoteNotification ===== %@", userInfo)
                  }
                
                
                 func tokenRefreshNotificaiton(notification: NSNotification) {
                    let refreshedToken = FIRInstanceID.instanceID().token()!
                    print("InstanceID token: (refreshedToken)")
                
                    // Connect to FCM since connection may have failed when attempted before having a token.
                     connectToFcm()
                  }
                
                  func connectToFcm() {
                    FIRMessaging.messaging().connectWithCompletion { (error) in
                      if (error != nil) {
                        print("Unable to connect with FCM. (error)")
                      } else {
                        print("Connected to FCM.")
                      }
                    }
                  }
                

                同样在 Info.plist FirebaseAppDelegateProxyEnabled = NO

                Also to done in Info.plist FirebaseAppDelegateProxyEnabled = NO

                我现在不知道,但我在 didReceiveRemoteNotification 中得到了 print(...),但没有得到弹出窗口.我从 Firebase -> Console -> Notification -> Single device 发送消息,并在此处复制我从 xCode Console -> func tokenRefreshNotificaiton 获得的令牌

                I don't know for now but I got the print(...) in didReceiveRemoteNotification but don't get the popup. I send the message from Firebase -> Console -> Notification -> Single device and copy here the token which I got from xCode Console -> func tokenRefreshNotificaiton

                在控制台中获取下一个,但不弹出

                Get the next in console, but don't get popup

                <FIRAnalytics/INFO> Firebase Analytics enabled
                InstanceID token: TOKEN_ID
                Connected to FCM.
                ===== didReceiveRemoteNotification ===== %@ [notification: {
                    body = test;
                    e = 1;
                }, collapse_key: com.pf.app, from: 178653764278]
                

                还有应用配置

                推荐答案

                在AppDelegate.m中设置如下代码

                set the following code in AppDelegate.m

                   - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
                
                    // for development 
                        [[FIRInstanceID instanceID] setAPNSToken:deviceToken type:FIRInstanceIDAPNSTokenTypeSandbox];
                
                    // for production 
                   //     [[FIRInstanceID instanceID] setAPNSToken:deviceToken type:FIRInstanceIDAPNSTokenTypeProd];
                
                
                    }
                

                这篇关于Firebase 收到推送通知时未收到弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:Firebase 令牌错误 TOO_MANY_REGISTRATIONS 下一篇:iOS 14 上的颤振 FCM 7

                相关文章

                <legend id='9UUXW'><style id='9UUXW'><dir id='9UUXW'><q id='9UUXW'></q></dir></style></legend>
                <tfoot id='9UUXW'></tfoot>

              • <i id='9UUXW'><tr id='9UUXW'><dt id='9UUXW'><q id='9UUXW'><span id='9UUXW'><b id='9UUXW'><form id='9UUXW'><ins id='9UUXW'></ins><ul id='9UUXW'></ul><sub id='9UUXW'></sub></form><legend id='9UUXW'></legend><bdo id='9UUXW'><pre id='9UUXW'><center id='9UUXW'></center></pre></bdo></b><th id='9UUXW'></th></span></q></dt></tr></i><div id='9UUXW'><tfoot id='9UUXW'></tfoot><dl id='9UUXW'><fieldset id='9UUXW'></fieldset></dl></div>

                  1. <small id='9UUXW'></small><noframes id='9UUXW'>

                      <bdo id='9UUXW'></bdo><ul id='9UUXW'></ul>