小编Dan*_*rge的帖子

Firebase云消息传递iOS:无后台推送通知

使用较新的Firebase云消息传递与方法调配我成功地能够didReceiveRemoteNotification在我的应用程序被预先考虑时在我的应用程序委托中的方法中接收有效负载.然而,我没有获得任何类型的有效负载,didReceiveRemoteNotification并且当我的应用程序被后台化时不会被调用,尽管api响应消息已成功发送(见下文)
这是我发送到FCM api以触发推送通知的请求 https://fcm.googleapis.com/fcm/send

{
"to": "{valid-registration-token}",
"priority":"high", //others suggested setting priority to high would fix, but did not
  "notification":{
      "body":"Body3",
      "title":"test"  
 } 
}
Run Code Online (Sandbox Code Playgroud)


来自FCM的回应

{
      "multicast_id": 6616533575211076304,
      "success": 1,
      "failure": 0,
      "canonical_ids": 0,
      "results": [
        {
          "message_id": "0:1468906545447775%a4aa0efda4aa0efd"
        }
      ]
    }
Run Code Online (Sandbox Code Playgroud)

这是我的appDelegate代码

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

        Fabric.with([Crashlytics.self])
        FIRApp.configure()

        NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(self.tokenRefreshNotification),
                                                         name: kFIRInstanceIDTokenRefreshNotification, object: nil)
        return true
    }



    func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : …
Run Code Online (Sandbox Code Playgroud)

apple-push-notifications ios firebase swift firebase-cloud-messaging

15
推荐指数
1
解决办法
1万
查看次数