【问题标题】:APNS Content Available Push not working in iOS 15APNS 内容可用推送在 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 静默推送消息的标头字段中是否有任何负载或配置?

【问题讨论】:

    标签: apple-push-notifications payload ios15 silent-notification silentpush


    【解决方案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
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-17
      • 1970-01-01
      相关资源
      最近更新 更多