ios - 在哪里为 iOS 13 的推送通知进行 header 字段配置?

标签 ios push-notification apple-push-notifications ios13 pushwoosh

根据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)

  1. APNS 负载 header 的第一个属性/参数:apns-push-type

    (:apns-push-type和:警报或背景)

  2. APNS 负载 header 的第二个属性/参数:apns-priority

    (:apns-push-type和:警报或背景)

这 2 个带有值的 header 字段必须添加到哪里?

来自后端数据库还是 PushWhoosh ?

或者我的代码级别?

有人可以帮忙吗?

因为它这么说,

“向运行 iOS 13 的设备发送通知时需要这些 header ”。此外,“如果所需系统上缺少 header ,APN 可能会延迟通知的传送或完全丢弃通知。”

有关更多信息,请参阅以下文章,

iOS 13 and Xcode 11 Changes That Affect Push Notifications

Sending Notification Requests to APNs

最佳答案

这是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.

这是我的电子邮件的屏幕截图, Sceenshot Of Email

因此,无需进行您要求的更改。

关于ios - 在哪里为 iOS 13 的推送通知进行 header 字段配置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58425348/

相关文章:

iOS 10 : Random Crashes in dispatch_async

ios - 为每个新推送添加一个新的 UITableViewCell

iphone - 2-3 天后推送通知?

objective-c - 如何使用 enabledRemoteNotificationTypes 更新代码,因为它是 "not supported in iOS 8"?

ios - Swift - UIPageViewController 中的 UIPinchGestureRecognizer

ios - 如何创建像下面这样的自定义导航栏?

flutter - 如何在用户主动与发件人聊天时隐藏新消息通知

iphone - 通知设置中缺少“提醒样式”选项

ios - 如何在 Swift 3 中使用 UITextFields 创建开关表达式

php - fwrite() : SSL operation failed with code 1. OpenSSL 错误消息:\nerror:1409F07F:SSL 例程:SSL3_WRITE_PENDING:PHP 中的错误写入重试