谷歌云消息显示成功的消息,但不发送的iOS [英] Google Cloud Messaging showing success message but not sending iOS

查看:252
本文介绍了谷歌云消息显示成功的消息,但不发送的iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我遇到了与谷歌云通讯一个很奇怪的问题。我遇到的问题是,它已成功注册的设备,当发送消息我从谷歌成功的消息。但是,设备从来没有收到任何消息。

So I have run into a very strange problem with Google Cloud Messaging. The problem I am having is that it is registering the devices successfully, and when a message is sent I get a success message from Google. But the devices never receive any messages.

我回来后从GCM发出的信息是:

The message I get back from GCM is:

"result": "Push notification sent successfully: {\"multicast_id\":6008387530769664000,\"success\":1,\"failure\":0,\"canonical_ids\":0,\"results\":[{\"message_id\":\"0:1442824842607522%73fc535e73fc535e\"}]}"

为了让事情更混乱,我的实现是工作约2个星期前,我没有改变任何东西至今。该应用的Andr​​oid版本正在接收没有问题,它只是不工作了iOS实施的消息。

To make things even more confusing, my implementation was working about 2 weeks ago and I have not changed anything to date. The Android version of the app is receiving messages with no problems it is only the iOS implementation that is not working.

任何帮助将是非常美联社preciated!

Any help would be much appreciated!

谢谢!

推荐答案

所以,我终于解决了这个问题,拉动了最后剩下的头发从我的头后。

So I finally solved this issue after of pulling the last remaining hairs out of my head.

原来的设备接收信息,但GCM默认设置的优先级为最低优先级。这意味着该设备接收到通知,但从来没有显示它。该优先级用于无提示的通知唤醒在后台的应用程序了。我发现这一点,因为我一直在控制台说法收到消息:

It turns out the devices are receiving the messages but GCM sets the priority to the lowest priority by default. This means the device receives the notification but never displays it. This priority is used for silent notifications to wake the app up in the background. I discovered this because I kept receiving the message in the console saying:

低优先级推送:[com.test.app] - 后台刷新不支持

Low Priority Push: [com.test.app] - Background Refresh Not Supported

优先级是一个价值1到10之间,所以我然后设置优先级为10,在设备上得到的消息瞬间。我GCM POST请求的身体现在看起来是这样的:

Priority is a value between 1 and 10 so I then set the priority to 10 and got the message instantly on the device. My GCM POST request body now looks like this:

{
  "to": "GCM token here",
  "notification": {
    "sound": "default",
    "badge": "2",
    "title": "default",
    "body": "Test Push!",
  },
   "priority" : 10,
} 

我真的希望这可以帮助别人,因为我花了一个星期拉我的头发对此。

I really hope this helps others as I have spent a week pulling my hair out regarding this.

(ノಠ益ಠ)ノ

编辑:

您可以设置优先级到高和作品完全一样将其设置为10(重点是谷歌0到10之间和覆羽文本的数量适用于iOS的值

You can set "priority" to "high" and that works exactly the same as setting it to "10" (priority is a value between 0 and 10. Google coverts the text to the number for iOS

这篇关于谷歌云消息显示成功的消息,但不发送的iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆