Gcm 在前台和后台时发送到 apn。 <- 发送好
但是如果强制退出应用程序,gcm 不会发送到 apn。 <- 发送不正确
当强制退出应用程序时,apn 可以发送通知,因为“APN 测试器”发送通知可用。
<测试条件>
iPhone 4
7.1.2
对象 c 代码(GcmExample.app)
使用 curl
< curl --header "Authorization: key=$server_api_key" \
--header Content-Type:"application/json" \
https://android.googleapis.com/gcm/send \
-d "{\"data\":{\"title\":\"title\"},\"notification\":{\"body\":\"noti test\",\"content_available\":true},\"to\":\"$token\"}" >
<等使用>
"GcmServerDemo"
工具"APN Tester"
工具
最佳答案
您应该尝试一 strip 有 high APNS priority
的消息例如
curl --header "Authorization: key=$server_api_key" \
--header Content-Type:"application/json" \
https://android.googleapis.com/gcm/send \
-d "{
'data': { 'title': 'title' }, \
'notification': {'body': 'notitest' }, \
'content_available': true, \
'to': '$token', \
'priority': 10,
}"
您需要设置
priority
明确到 10
否则 GCM 假定正常的 APNS 优先级可能会被高度延迟。Here is the GCM reference您可以在哪里阅读
priority
field 。
关于ios - 当iOS应用程序被杀死时,Gcm不会发送到应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32370942/