Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically delete Remote Notifications from Notification Centre

How can we pragmatically remove any pending remote notifications sent for my app from notification centre. I want to clear them up on app launch.

I have tried with [[UIApplication sharedApplication] cancelAllLocalNotifications]; API but its not helping.

PS: This question is specific to iOS 10 and old threads are not duplicates for this one.

like image 666
Abhinav Avatar asked Dec 14 '22 23:12

Abhinav


1 Answers

Finally...

This one works like charm!

[[UNUserNotificationCenter currentNotificationCenter] removeAllDeliveredNotifications];
like image 145
Abhinav Avatar answered May 07 '23 07:05

Abhinav