Currently I cannot clear a local notification in app (example: A reminder) which i scheduled from Notification Service Extension (NSE).
i've tired clearing using the following APIs,
NSArray *ids = @[@"Notify_from_app",@"Notify_from_extension"]; UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; [center removeAllDeliveredNotifications]; [center removePendingNotificationRequestsWithIdentifiers:ids];
The above code works fine, when i try to clear a notification in NSE, which is scheduled from the same NSE. (if i try to clear from app, i can't)
FYI, i'm able to clear all the notifications using the following code. (but my goal is to clear the notification using identifiers, a specific notification)
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; [center removeAllDeliveredNotifications]; [center removeAllPendingNotificationRequests];
As per apple's documentation, the currentNotficationCenter object supports app extensions as well, that's why I'm able to schedule a local notifications from there.
I'm looking for a proper solution to clear the reminders, Please help me out.