Reputation: 2526
In the application, I have received the local notification and taken the appropriate actions - so far so good. But after that, what's the appropriate actions to take to "clean up" the local notification object?
I haven't found any direct instruction on this in my search of Apple/StackOverflow, so I assume it's just discarded by iOS and as long as I release any related the object/properties then I should be good to go.
But am I missing anything? Do i have to cancel it from UIApplication? I wouldn't want for these just to be accumulating in the scheduledLocalNotifications array, for example.
Thanks.
Upvotes: 0
Views: 337
Reputation: 22395
Once the user actually receives the notification thats it, its gone from the schedule and you dont have to do anything to clean up the notification, if you have scheduled local notications (that have not fired) and want to clean those up you can do something like
UIApplication* app = [UIApplication sharedApplication];
NSArray* oldNotifications = [app scheduledLocalNotifications];
// Clear out the old notification before scheduling a new one.
if ([oldNotifications count] > 0)
[app cancelAllLocalNotifications];
Hope it helps
Upvotes: 3