我已经设法让 GCM 在 iOS 上运行,但我仍然无法发送正确的有效负载,因此推送会出现在锁定屏幕上。
如果我发送
{
"to" : "my google token",
"notification" : {
"title" : "Hello, world!",
"body" : "default",
"badge":5
}
}
设备只是没有收到推送。但是,如果我删除“通知”对象 - 推送会完美无缺。有什么想法吗?
已审核回复 - 我明白了
{
"multicast_id":8119244679462523689,
"success":0,
"failure":1,
"canonical_ids":0,
"results":[{
"error":"InternalServerError"
}]
}
最佳答案
找到解决方案。我使用过生产证书,但在 GCM SDK 初始化时我启用了沙盒模式。
[[GGLInstanceID sharedInstance] startWithConfig:[GGLInstanceIDConfig defaultConfig]];
_registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
kGGLInstanceIDAPNSServerTypeSandboxOption:@YES};
更改为 OFF,一切正常。
关于iOS 谷歌云消息传递无效负载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32522428/