In my app, I set up local notifications to notify the user while the app is running. In order to clean these up in case the app is terminated, I have set up applicationWillTerminate:
to clear these notifications:
- (void)applicationWillTerminate:(UIApplication *)application
{
NSLog(@"applicationWillTerminate");
[[UIApplication sharedApplication] cancelAllLocalNotifications];
}
Unfortunately, if the app crashes, or I terminate debugging, this function isn't called and therefore I still get the local notifications delivered to the device.
Is there a way of definitely checking if the application has quit unexpectedly so I can tidy these up?