gpt4 book ai didi

ios - 当iOS应用程序被杀死时,Gcm不会发送到应用程序

转载 作者:行者123 更新时间:2023-12-01 18:49:25 24 4
gpt4 key购买 nike

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com