iOS Google 云消息传递无效负载
iOS Google Cloud Messaging invalid payload
我已经设法让 GCM 在 iOS 上工作,但我仍然无法发送正确的负载,因此推送会出现在锁定屏幕上。
如果我发送
{
"to" : "my google token",
"notification" : {
"title" : "Hello, world!",
"body" : "default",
"badge":5
}
}
设备只是收不到推送。但是,如果我删除 "notification" 对象 - 推送会完美无缺。有什么想法吗?
已查看回复 - 我明白了
{
"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};
更改为关闭,一切正常。
我已经设法让 GCM 在 iOS 上工作,但我仍然无法发送正确的负载,因此推送会出现在锁定屏幕上。
如果我发送
{
"to" : "my google token",
"notification" : {
"title" : "Hello, world!",
"body" : "default",
"badge":5
}
}
设备只是收不到推送。但是,如果我删除 "notification" 对象 - 推送会完美无缺。有什么想法吗?
已查看回复 - 我明白了
{
"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};
更改为关闭,一切正常。