Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.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
Ios GCM APN消息不是';t交付_Ios_Swift_Google Cloud Messaging - Fatal编程技术网

Ios GCM APN消息不是';t交付

Ios GCM APN消息不是';t交付,ios,swift,google-cloud-messaging,Ios,Swift,Google Cloud Messaging,我正在尝试使用GCM向设备发送消息。我将此JSON发送到客户端: { "to": "nzgmI.....smZq9tE_L6k4C6T", "data": { "message": "vale normal de menfdasfdsajes", } } 我可以在控制台上看到它,但是如果我想要一个标准的ios推送通知来获得一个对话框,我没有收到任何东西 { "to": "nzgmIZ764.....tE_L6k4C6T", "notification" : {

我正在尝试使用GCM向设备发送消息。我将此JSON发送到客户端:

  {
"to": "nzgmI.....smZq9tE_L6k4C6T",
"data": {
  "message": "vale normal de menfdasfdsajes",
 }
}
我可以在控制台上看到它,但是如果我想要一个标准的ios推送通知来获得一个对话框,我没有收到任何东西

  {
    "to": "nzgmIZ764.....tE_L6k4C6T",
    "notification" : {
      "body" : "I can't see this",
      "title" : "Portugal vs. Denmark",
      "icon" : "myicon"
    }
  }
我有一张打印在:

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {

但只有使用第一个选项,我才能在控制台中看到一些东西,我希望实现常规推送通知,而不仅仅是消息。

您可能需要在消息中添加
优先级
字段,即

{
    "to": "nzgmIZ764.....tE_L6k4C6T",
    "priority" : "high", // Add this 
    "notification" : {
      "body" : "I can't see this",
      "title" : "Portugal vs. Denmark",
      "icon" : "myicon"
    }
}

如果您收到来自GCM的
成功
响应,您应该会看到一个正常的通知被发送到您的应用程序。

您可能需要将
优先级
字段添加到您的消息中,即

{
    "to": "nzgmIZ764.....tE_L6k4C6T",
    "priority" : "high", // Add this 
    "notification" : {
      "body" : "I can't see this",
      "title" : "Portugal vs. Denmark",
      "icon" : "myicon"
    }
}
如果您从GCM收到
成功的
响应,您应该会看到一个正常的通知发送到您的应用程序