根据Apple's APNs docs ,从 iOS 13 开始,http api 的客户端必须发送 apns-push-type 和 apns-priority 的 header 字段,否则请求将失败。
果然,我们已经升级到 iOS 13 Beta 版的用户并没有收到我们通过 Pushwoosh 发送的静默推送通知。
在我的代码级别(在我的 Xcode 中)进行了所有需要的更改。
现在唯一悬而未决的是必须在有效负载中添加 2 个 header 。 (Here is the article)
APNS 负载 header 的第一个属性/参数:apns-push-type
(键:apns-push-type和值:警报或背景)
APNS 负载 header 的第二个属性/参数:apns-priority
(键:apns-push-type和值:警报或背景)
这 2 个带有值的 header 字段必须添加到哪里?
来自后端数据库还是 PushWhoosh ?
或者我的代码级别?
有人可以帮忙吗?
因为它这么说,
“向运行 iOS 13 的设备发送通知时需要这些 header ”。此外,“如果所需系统上缺少 header ,APN 可能会延迟通知的传送或完全丢弃通知。”
有关更多信息,请参阅以下文章,
最佳答案
这是Pushwoosh团队提供的信息,
First of all, it should be emphasised that we took the necessary actions on our side before the release of the iOS 13 to avoid issues with silent pushes.
Regarding the apns-priority parameter, please note that our sender always includes this parameter for iOS silent pushes by default. So it is not necessary to add it by yourself.
As for the apns-push-type parameter, it was introduced with iOS 13. It is required for pushes to watchOS and is not required(for now) for pushes to iOS. This parameter does not add any "tricky" behaviour for push notifications. This is also described in the Apple article you have provided.
因此,无需进行您要求的更改。
关于ios - 在哪里为 iOS 13 的推送通知进行 header 字段配置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58425348/