相关疑难解决方法(0)

接收推送通知时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 ===== …
Run Code Online (Sandbox Code Playgroud)

ios firebase google-cloud-messaging firebase-cloud-messaging firebase-notifications

16
推荐指数
2
解决办法
2万
查看次数

应用关闭时,Firebase IOS推送通知无效

关闭应用时,Firebase IOS推送通知功能无效.我已按照文档中的所有步骤进行操作

ios firebase

7
推荐指数
1
解决办法
3654
查看次数