【发布时间】:2017-03-15 14:06:29
【问题描述】:
iMessage 在屏幕上更新富推送。您可以看到用户正在输入的内容,并且消息将添加到您的对话中。
所以问题是:当我已经在查看打开的富推送时,我如何才能捕捉到新的推送通知? UNNotificationContentExtension 中是否有任何事件可以捕获新事件并更新视图?我唯一知道的是:
- (void)didReceiveNotification:(UNNotification *)notification
编辑:
在UNNotificationContentExtension协议中发现:
// 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;
所以它应该可以工作,但我无论如何都无法捕捉到这个事件。也许我需要以某种方式使新通知与当前显示“相关”?
【问题讨论】:
标签: ios objective-c swift push-notification notification-content-extension