当 iOS 应用被终止时,Gcm 未发送到 apn
Gcm not sended to apn when iOS app was killed
Gcm在前台和后台时发送给apn。 <- 发送成功
但是如果强制退出应用程序,gcm 不会发送到 apn。 <- 发送不成功
强制退出应用程序时,apn 可以发送通知,因为"APN Tester" 发送通知可用。
<测试条件>
iPhone 4
7.1.2
对象 c 代码(GcmExample.app)
使用卷曲
< 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"
工具
您应该尝试包含 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
字段的信息。
Gcm在前台和后台时发送给apn。 <- 发送成功
但是如果强制退出应用程序,gcm 不会发送到 apn。 <- 发送不成功
强制退出应用程序时,apn 可以发送通知,因为"APN Tester" 发送通知可用。
<测试条件>
iPhone 4
7.1.2
对象 c 代码(GcmExample.app)
使用卷曲
< 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"
工具
您应该尝试包含 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
字段的信息。