【问题标题】:iOS Google Cloud Messaging invalid payloadiOS Google Cloud Messaging 无效负载
【发布时间】:2015-09-11 11:30:19
【问题描述】:

我已经设法让 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"
           }]
}

【问题讨论】:

    标签: ios google-cloud-messaging push


    【解决方案1】:

    找到了解决办法。我使用了生产证书,但在初始化 GCM SDK 时,我开启了沙盒模式。

      [[GGLInstanceID sharedInstance] startWithConfig:[GGLInstanceIDConfig defaultConfig]];
     _registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
                           kGGLInstanceIDAPNSServerTypeSandboxOption:@YES};
    

    更改为关闭,一切正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-07-31
      • 1970-01-01
      • 1970-01-01
      • 2018-04-06
      • 2016-08-07
      • 2015-11-05
      • 1970-01-01
      相关资源
      最近更新 更多