APNS 内容可用推送在 iOS 15 中不起作用

Posted

技术标签:

【中文标题】APNS 内容可用推送在 iOS 15 中不起作用【英文标题】:APNS Content Available Push not working in iOS 15 【发布时间】:2021-11-25 11:05:35 【问题描述】:

使用 Xcode 13.0、ios 15 SDK 构建应用时,iOS 15 设备中未收到可用的 APNS 内容推送。

推送内容可用的有效负载数据:1 不工作

"aps":"content-available":1,"update":"2|1"

但正常的通知消息推送工作

"aps":"alert":"welcome"

iOS 15 静默推送消息的标头字段中是否有任何负载或配置?

【问题讨论】:

【参考方案1】:

是的,有。根据Apple's Documentation:

通知的 POST 请求应包含值为 background 的 apns-push-type 头字段和值为 5 的 apns-priority 字段。APNs 服务器在发送推送通知时需要 apns-push-type 字段到 Apple Watch,并推荐用于所有平台。

标题如下所示:

request_headers = 
    'apns-expiration': '0',
    'apns-priority': '5', # must be 5 for silent pushes, otherwise it will not be sent
    'apns-topic':'your_app_bundle_id',
    'authorization': 'bearer your_jwt_token'
    'apns-push-type': 'background' # this field is not required

【讨论】:

以上是关于APNS 内容可用推送在 iOS 15 中不起作用的主要内容,如果未能解决你的问题,请参考以下文章

iOS - 推送通知在辞职的 IPA 中不起作用

Nodejs 静默推送通知在 iOS 13 中不起作用

iOS APNs 推送通知 - 开发

iOS 推送通知在生产环境 (GPGS) 中不起作用

带有 Swift 的 Firebase 推送通知在 ios 11.4 中不起作用

iOS MDM:推送不起作用