ApplicationWillTerminate: not called

I use applicationWillTerminate: to save some things at the last minute. But the problem is that it is never called. If I do something like this at the top of the method: NSLog(@"Something"); it is not called or displayed on the console.

Does anyone know why this is happening?

+4
source share
4 answers

From Apple docs:

For applications that do not support background execution or are associated with iOS 3.x or earlier, this method is always called when the user exits the application. For applications that support background execution, this method is usually not called when the user exits the application, because the application simply moves to the background in this case. However, this method can be called in situations when the application is running in the background (not paused), and the system should stop it for some reason.

If your application has the ability to use background:

- (void)applicationDidEnterBackground:(UIApplication *)application

+10
source

Use applicationDidEnterBackground: instead. Applications do not interrupt when you press the home button in a multi-tasking system.

+4
source

From the iOS Application Programming Guide for Application and Application Development Timing:

The ApplicationWillTerminate: method is not called if your application is currently paused.

If you are connecting to iOS 4.0, you must also save data to applicationDidEnterBackground:

+1
source

Step 1: command + shift + h (double click (tab))

step 2: move the top of the application (kill)

step 3: applicationWillTerminate Work

+1
source

All Articles