Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
应用程序处于后台时未收到Swift FCM数据消息(iOS 10)_Ios_Swift_Firebase_Push Notification_Firebase Cloud Messaging - Fatal编程技术网

应用程序处于后台时未收到Swift FCM数据消息(iOS 10)

应用程序处于后台时未收到Swift FCM数据消息(iOS 10),ios,swift,firebase,push-notification,firebase-cloud-messaging,Ios,Swift,Firebase,Push Notification,Firebase Cloud Messaging,我已经一次又一次地浏览了我能找到的每一篇文章,并阅读了Firebase文档,但我没有发现错误。我的应用程序在前台接收FCM数据消息,因此没有问题。但当应用程序在后台运行时,不会收到任何数据。它甚至不会在应用程序打开后显示。 消息优先级设置为“高”,而“内容可用”设置为true。我应该收到一堆身份证。 以下是我的AppDelegate代码(主要来自FCM示例代码): 我已经激活了推送通知和后台模式:Info.plist中的“远程通知”。理想情况下,我希望在后台处理数据,并向用户发送通知(如果与他们

我已经一次又一次地浏览了我能找到的每一篇文章,并阅读了Firebase文档,但我没有发现错误。我的应用程序在前台接收FCM数据消息,因此没有问题。但当应用程序在后台运行时,不会收到任何数据。它甚至不会在应用程序打开后显示。 消息优先级设置为“高”,而“内容可用”设置为true。我应该收到一堆身份证。 以下是我的AppDelegate代码(主要来自FCM示例代码):

我已经激活了推送通知和后台模式:Info.plist中的“远程通知”。理想情况下,我希望在后台处理数据,并向用户发送通知(如果与他们有关)

发送的数据如下所示:

{
  "to": "\/topics\/substitutions",
  "priority": "high",
  "content_available": true,
  "data": {
    "debug": true,
    "new_ids": [
      7914,
      7915,
      7916,
      7917,
      7918
    ],
    "updated_ids": [

    ]
  }
}

如果有人知道这个问题的解决方案,我将不胜感激。

您必须添加
通知
负载才能在后台接收通知

{
  "to": "\/topics\/substitutions",
  "priority": "high",
  "content_available": true,
  "data": {
    "debug": true,
    "new_ids": [
      7914,
      7915,
      7916,
      7917,
      7918
    ],
 "notification":{
      "title":"Sample Title",
      "body":"sample body!"
    }
    "updated_ids": [

    ]
  }
}

更多信息

您好。你能公布你发送的实际有效载荷吗?谢谢你的回答。这就是我需要的
{
  "to": "\/topics\/substitutions",
  "priority": "high",
  "content_available": true,
  "data": {
    "debug": true,
    "new_ids": [
      7914,
      7915,
      7916,
      7917,
      7918
    ],
 "notification":{
      "title":"Sample Title",
      "body":"sample body!"
    }
    "updated_ids": [

    ]
  }
}