gpt4 book ai didi

ios - Apple 推送通知折叠键等效项

转载 作者:IT王子 更新时间:2023-10-29 08:08:46 33 4
gpt4 key购买 nike

使用 Google 推送通知时,我可以指定一个 collapse_key 值,这样设备就不会收到同一个 collapse_key 的多个通知。

APNS 是否具有类似的功能,或者有人知道模拟此功能的方法吗?

最佳答案

从 iOS 10 开始,使用 HTTP/2.0 APNS API,您可以指定 apns-collapse-id header 并处理应用中的折叠逻辑。

折叠的通知将在不断更新新数据的设备上显示为一个单独的通知。每次更新通知时,它都会被推送到未读通知的顶部。

apns-collapse-id 的描述取自 https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html :

Multiple notifications with same collapse identifier are displayed to the user as a single notification. The value should not exceed 64 bytes. For more information, see Quality of Service, Store-and-Forward, and Coalesced Notifications.

来自https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html#//apple_ref/doc/uid/TP40008194-CH8-SW1 :

When a device is online, all the notifications you send are delivered and available to the user. However, you can avoid showing duplicate notifications by employing a collapse identifier across multiple, identical notifications. The APNs request header key for the collapse identifier is apns-collapse-id and is defined in Table 6-2.

For example, a news service that sends the same headline twice in a row could employ the same collapse identifier for both push notification requests. APNs would then take care of coalescing these requests into a single notification for delivery to a device.

关于ios - Apple 推送通知折叠键等效项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12413477/

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