0

I have created notifications with UILocalNotification() and I'm trying to clear the received notifications, without removing the rest that are scheduled.

This is the code I'm trying to use:

UIApplication.sharedApplication().applicationIconBadgeNumber = 0
UIApplication.sharedApplication().cancelAllLocalNotifications()

However this seems to delete all scheduled, is there not a clearRescivedNotifcations() ?

Eli Stone
  • 1,515
  • 4
  • 33
  • 57

1 Answers1

0

Thanks to @LeoDabus I found the answer on iOS application: how to clear notifications?

Converted an answer from objective-c to swift

UIApplication.sharedApplication().scheduledLocalNotifications = UIApplication.sharedApplication().scheduledLocalNotifications

This removes all notifications from the notification centre & keeps anything scheduled.

Community
  • 1
  • 1
Eli Stone
  • 1,515
  • 4
  • 33
  • 57