CancelAllLocalNotifications in applicationWillTerminate?

I want to cancel AllLocalNotifications and setApplicationIconBadgeNumber to 0 when my application is completed (either by the operating system, or by double-clicking the home button and killing the application). I just added these two calls to my main application delegation code:

-(void)applicationWillTerminate:(UIApplication *)application 
{
        [application cancelAllLocalNotifications];
        [application setApplicationIconBadgeNumber:0];
}

Are existing notifications still running and the icon number remains set?

+3
source share
2 answers

applicationWillTerminate:not called by the operating system when it kills your application. The OS simply kills the process without notifying the application. There is currently no documented way to execute code.

+1
source

applicationWillResignActive:.

iOS 4.0 applicationWillTerminate , . , "" .

0

All Articles