Search code examples
iosnotificationsuilocalnotificationnsnotificationcenterlockscreen

Unable to Remove Local Notification from Lockscreen


In my app, at some point I need to display some notification to the user, in case user didn't respond to them, I need to remove that notification. Now, if I call cancelAllLocalNotifications function it does remove notification from notification center (also removes the alert from Home-screen, when the device is unlocked).

But when device is locked and notification is displayed on the lock-screen. After sometime, my app calls cancelAllLocalNotifications function. Now, this doesn't remove Notification from Lock-screen, however there is no item in notification center.


Solution

  • Using cancelAllLocalNotifications won't remove the already showed ones. It cancels all notifications that are scheduled. I don't think there is a way to clear a notification from the lock screen.