gpt4 book ai didi

iOS更新推送内容扩展

转载 作者:行者123 更新时间:2023-11-28 15:47:24 25 4
gpt4 key购买 nike

iMessage 会在屏幕上更新丰富的推送。您可以看到用户正在输入的内容,消息将添加到您的对话中。

所以问题是:当我已经在查看打开的丰富推送时,我如何才能捕捉到新的推送通知? UNNotificationContentExtension 中是否有任何事件可以捕获新事件并更新 View ?我唯一知道的是:

- (void)didReceiveNotification:(UNNotification *)notification

但是只有第一次打开推送才会触发 iMessage rich push

编辑:

在UNNotificationContentExtension协议(protocol)中发现:

// This will be called to send the notification to be displayed by
// the extension. If the extension is being displayed and more related
// notifications arrive (eg. more messages for the same conversation)
// the same method will be called for each new notification.
- (void)didReceiveNotification:(UNNotification *)notification;

所以它应该可以工作,但我还是无法捕捉到这个事件。也许我需要以某种方式使新通知与当前显示“相关”?

最佳答案

找出问题所在。

苹果文档:

When displaying notifications, the system visually groups notifications with the same thread identifier together. For remote notifications, the value of this property is set to the value of the thread-id key in the aps dictionary.

将键“thread-id”添加到 aps 字典后,此函数现在可以正确接收事件

- (void)didReceiveNotification:(UNNotification *)notification;

关于iOS更新推送内容扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42812113/

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