iOS 谷歌云消息传递无效负载

标签 ios google-cloud-messaging push

我已经设法让 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/

相关文章:

ios 8 addSubview 导致后台黑屏

java - 收到推送通知和未调用 CGM Intent 服务时应用程序崩溃

android - 某些设备上的谷歌云消息传递错误

git - Gitlab中 "Allowed to push"和 "Allowed to merge"的含义

ios - 滑动返回只能在屏幕边缘使用吗?

ios - 通过自定义应用程序在 iOS 10.1 中打开设置应用程序

php - 如何从 PHP 网站向 iOS 和 Android 发送推送通知?

linux - Etckeeper + git 和远程服务器

ios - 在 Swift 3.0 中创建目录

ios - 在某些 Apple 设备上未收到后台 GCM 推送通知