Prior to iOS 9, calling [[UIApplication sharedApplication] cancelAllLocalNotifications] would clear all presented notifications from the Notification Center and Lock Screen. Now it doesn't seem to have any effect. Has it been deprecated or is it just a bug? Shall I file a bug report?
cancelAllLocalNotifications not clearing local notifications
I have a similiar problem. The local notifications is not working correctly in iOS 9. Sometimes my app show notification, sometimes not! When user put, for ex 10 reminders, no notifications are show.
Please make sure you file a bug with Apple, then they'll be more likely to look into it and hopefully both our problems will be fixed.
Similar problem... cancelLocalNotification and cancelAllLocalNotifications are not clearing local notifications...
Situation:
Local notification with repeatInterval as NSMinuteCalendarUnit
Result:
cancelLocalNotification seems to cancel the notification because [[UIApplication sharedApplication] scheduledLocalNotifications] count goes to 0, but iOS re-fires and keeps to fire the notification....
NB: Already reported on Bug Reporter
I have exactly this problem. With local notification repeatInterval NSMinuteCalendarUnit, the notification is firing every minute, even and cancelAllLocalNotifications run. If I count local notifications at iOS Notification Center after run cancelAllLocalNotifications the result is 0. But the notification stil firing.
I've already has a bug report about this problem.
Hi kane.codes,
Did you find any solution for this issue?
It seems that this bug occurs at xcode7 GM 7.0 (7A218), have been fixed at xcode 7.0 (7A220).
I'm using Xcode 7A220, but it seams the bug is not completely solved. As in past, cancelAllLocalNotifications work sometimes. Now (7A220) it seams work better, but sometimes a notification with repeatInverval with NSMinuteCalendarUnit still fire, even when cancelAllLocanNotifications run.
Can anyone confim this is a bug of previews versions of Xcode 7?
As you pointed, I also confirmed that the LocalNotification is still unstable at Xcode 7A220.
But, I may find some solution for these kind of bugs.
Actually, my problem were unstable cancelAllLocalNotifications and multiple notifications action.
When I fire three notifications, it sometimes fired only two or sometimes one.
So, I moved initializing sentence like "UILocalNotification *localNotif = [[UILocalNotification alloc] init];" from out of Local Notification fire loop to inside of it.
Then, unstable notification action were solved.
I guess these phenomenon may be caused by "nil" treatment method of new Xcode.
I hope this is the solution of these problems or some hint.
I had this problem too. And I solved this like you do, move "UILocalNotification *localNotif = [[UILocalNotification alloc] init];" to inside the loop. But when use repeatInverval with NSMinuteCalendarUnit, sometimes it makes a ghost notification that not cancel with cancelAllLocalNotifications and either with cancelLocalNotification.
What do you mean with "fire loop"?
Yeah, It can drive you nuts to work with local notifications in iOS9. I'm having the same problems.
"fire loop" means multiple Local Notification fire as follows.
for (i = 1; i <= 3; i++) {
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
}
Regarding repeatInverval cancel problem, sorry, I have no idea so far.
Looks like I've run into the same/similar problem to you guys... any progress with this? I've got repeating notifications every minute and cancelling them doesn't seem to do the trick in certain situations.
I did have an issue where I would cancel the notification and then on the same instance of the notification I'd make a change to alertBody or soundName and then I'd schedule it again. That was causing the version of the app built against iOS 8 to not actually cancel the notification (when running on iOS 9) but I managed to fix that (when building against iOS 9) by not being lazy in reusing the existing notification and instead creating a new one and copying the fields over. But now, on iOS 9, when I want to stop a repeating notification it's as if I'm just being ignored by iOS...
Incidentally here's the thread on StackOverflow where I was led onto the fix for the dodgy reuse of the notification, they suggested that changing a notification after it had been cancelled meant it wouldn't actually be cancelled, though it doesn't seem like I'm doing anything like that when trying to stop the notifications...
EDIT: Multiple times I think I've solved this but to no avail... basically it seems like notifications scheduled before I ran my app built against iOS 9 can't be cancelled, at least not in any easy way... any created after the app built against iOS 9 can be deleted fine... so it seems like legacy notifications are somewhat ignored by iOS 9 when you ask for them to be cancelled...