GCM可以在Android上正常工作,但不适用于iOS [英] GCM works fine on Android but not working on iOS

查看:107
本文介绍了GCM可以在Android上正常工作,但不适用于iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功实现了android的GCM,但是当我试图将它实现到我的iOS版本时,我不会收到推送消息。



iOS版本的gcm令牌,并可能发送消息(我使用Postman)。
我得到了一个成功的响应和唯一的消息ID,但没有收到推送。



我试图创建一个新的GCm项目,并且为iOS运行GCM示例,但没有任何效果。



我使用相同的iOS和Android帐户,使用相同的apiKey of course。



邮递员代码:

  {
collapse_key:score_update,
time_to_live:108,
delay_while_idle: true,
data:{
score:4x8,
time:15:16.2342
},
registration_ids: [我的令牌],
}

我错过了什么?

令人难以置信的是,不得不用通知来改变数据。
iOS的有效载荷有点不同。有关详细信息,请访问此处


I've succefuly implemented the GCM for android but when I tried to implement it to my iOS version I won't get the push messages.

I got my gcm token at the iOS version, and could sent messages (I used Postman). I got a succesful response and a unique message ID but no push recieved. I've been struggling with this for few days.

i tried to create a new GCm project and also running the GCM examples for iOS but nothing works.

I'm using the same account for iOS and Android with same apiKey ofcourse.

Postman code:

{
          "collapse_key": "score_update",
          "time_to_live": 108,
          "delay_while_idle": true,
          "data": {
            "score": "4x8",
            "time": "15:16.2342"
          },
          "registration_ids":["My Token"],
}

What am I missing?

解决方案

Unbelievable, had to change "data" with "notification". The payload for iOS is bit different. More info can be found here

这篇关于GCM可以在Android上正常工作,但不适用于iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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