iOS update push in content extension
Asked Answered
N

1

1

iMessage updates the rich push when it's on the screen. You can see what is user is typing RIGHT NOW, and message will be added to your conversation.

So the question is: how i can catch new push notification, when i'm already looking at opened rich push? Is there any event in UNNotificationContentExtension to catch the new one and update view? The only one i know is:

- (void)didReceiveNotification:(UNNotification *)notification

but it is triggered only when you open the push first time iMessage rich push

Edit:

Found that in 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;

So it should work but i can't catch this event anyway. Maybe i need somehow to make new notification "related" to currently displayed?

Necrose answered 15/3, 2017 at 14:6 Comment(0)
N
2

Figured where's was the problem.

Apple docs:

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.

After adding key "thread-id" to aps dictionary, this func now receiving events correctly

- (void)didReceiveNotification:(UNNotification *)notification;
Necrose answered 15/3, 2017 at 15:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.