gpt4 book ai didi

ios - 当应用程序在后台时 didReceiveRemoteNotification 不使用 Firebase 调用

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:25:27 25 4
gpt4 key购买 nike

使用 Firebase 我发送这个 JSON:

{
"data": {
},
"priority": "high",
"to": "xxxxx",
"content-available": "true",
"notification": {
"body": "HI!",
"title": "FCM Message",
"badge": 1,
"sound": "Default"
}
}

但是 didReceiveRemoteNotification:fetchCompletionHandler 在应用程序处于后台时不会被调用。

我启用后台模式 - 来自功能的远程通知。

有什么建议吗?

最佳答案

您的 content-available 键/值不正确。键是 content_available(下划线,不是破折号),值是 bool 值,而不是字符串:

{
"data": {
},
"priority": "high",
"to": "xxxxx",
"content_available": true, // <= CHANGED
"notification": {
"body": "HI!",
"title": "FCM Message",
"badge": 1,
"sound": "Default"
}
}

参见 Table 1 of the HTTP Server Protocol document :

On iOS, use this field to represent content-available in the APNs payload. When a notification or message is sent and this is set to true, an inactive client app is awoken. On Android, data messages wake the app by default. On Chrome, currently not supported.

关于ios - 当应用程序在后台时 didReceiveRemoteNotification 不使用 Firebase 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44724994/

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