3
votes

Every time my app enter background, I call [[UIApplication sharedApplication] cancelAllLocalNotifications]; first.Then I reschedule localnotifications as need.

But sometimes localnotification that scheduled long time ago and should be canceled still fired.I put create time in userinfo of each localnotification. In didReceiveLocalNotification:(UILocalNotification *)notification method I get create time of this notification. And cancelAllLocalNotifications was called after that time. So I'm 100% sure this notification should be canceled.It's so wired that it still fired!

My app was tested on iOS9.0.2.Does any one has similar problem?

1
I can't find it anymore, but this problem has been posted here a few days ago. It's an iOS 9 bug apparently. - Quentin Hayot

1 Answers

0
votes

Use this way for remove one by one Local Notification of app. It's working, exactly as you want.

    NSArray *arrayLocalNotif = [[UIApplication sharedApplication] scheduledLocalNotifications] ;
    for (UILocalNotification *localNotification in arrayLocalNotif) {
        [[UIApplication sharedApplication] cancelLocalNotification:localNotification] ;
    }