I am setting multiple local Notification and I have set number of actions to notification . like snooze , show , close .
func didReceive(_ response: UNNotificationResponse, completionHandler completion: @escaping (UNNotificationContentExtensionResponseOption) -> Void) {
let id = response.notification.request.identifier
if response.actionIdentifier == "SnoozeId" {
completion(UNNotificationContentExtensionResponseOption.dismiss)
}}
On didReceive - if action is snooze - perform snooze and then i dismiss the notifiction . as i dismiss all the other notifications are gone from notification centre . If I have two Notification A and B . If i longpress and perform snooze on A . Both A and B are gone from notificaiton centre . it should dismiss only A.
Here are the results from testing with my app.
To better answer your question, please provide more information such as - the json of the notification and its userInfo (maybe you are grouping the notifications and dismissing all at once?) and what function you are calling that results in the call to didReceive(...).
If you call
then it closes the content extension but does not dismiss it.
If you call:
then it completes the action and dismisses that single notification (not others). However, this opens the application, and you might not want to do this.
I have my delegate set up like this: