I have an app with local notification at the App Store.
In the last 4 version updates to my app, there were customers who experienced something strange - the app lost control over previous notifications, they kept getting all notification scheduled before the update, even though they should've been canceled by [[UIApplication sharedApplication] cancelAllLocalNotifications]
!
While communicating with these customers, I told them to turn off reminders, something that performs cancelAllLocalNotifications
, but they claim to keep getting reminders.
Also, reinstalling the app doesn't get rid of the old notifications! It's as if iOS thinks this is a different app.
It doesn't happen to most of my customers, only to rare few - but still, it happens every update!
How can it be?
Update
3 years later and it's still happening.
Every update some customers keep receiving local notifications, but the app can't see those, nor can control them.
Can anyone solve this or prove it is a bug of iOS?
Add the following code to your application:didFinishLaunchingWithOptions: method to clear all the notification.
Once done you can add the new notifications.
Did you check How does UIApplication cancelAllLocalNotifications work between app updates? It doesn't have definitive answers, but maybe it would be useful.
Try to find out what's so special about the customer that experience this:
I had similar issues with notifications. My solution to actually delete was to set a specific date and only notify once. The line applicationIconBadgeNumber = 0 removes the notification from notifications list. The badge number is only set when the user entered the app. For the case when the user didn't see the message yet you can just add a check in applicationWillEnterForeground and display a proper UIAlertView with the same message as the notification, and you can get the last notification in a similar way by using notificationArray. When you need to set a new notification "isNotified" needs setValue:@"0" and be synchronized. When I use multiple notifications I save states like this:
In MainViewController.m
In AppDelegate.m
Hey that is what is also happening with my app as well. My local notifications are getting fired in below scenerios :
1. user has deleted the app
-Actually its
UILocalNotification
behave, we have to cancel them else IOS retain them for at least some time(not sure how long) when app is deleted and they were scheduled by the app at deletion time and were not canceled.So always make sure when ever your app install happens,keep a check & cancel all scheduled notifications.
like
cancelAllLocalNotifications
will cancel all existing notifications.Hope it will help.