From apple documentation .
Informs the delegate that the application is now in the background.
- (void)applicationDidEnterBackground:(UIApplication *)application
Parameters expression Instance of a singleton application.
Discussion In iOS 4.0 and later, this method is called instead of the applicationWillTerminate: method when a user terminates an application that supports background execution. You should use this method to free up shared resources, save user data, invalidate timers, and store enough information about the state of the application to restore your application to its current state if it stops later. You should also disable application UI updates and avoid using certain types of system shares (such as a user contact database). It is also imperative to avoid using OpenGL ES in the background.
Your implementation of this method has about five seconds to complete any tasks and return. If you need extra time to complete any final tasks, you can request additional execution time from the system by calling beginBackgroundTaskWithExpirationHandler: In practice, you should return as soon as possible with applicationDidEnterBackground: If the method does not return before the time runs out, your application terminates and is cleared from memory.
You must complete any tasks related to setting up the user interface before this method exits, but other tasks (for example, saving state) should be moved to the parallel send queue or secondary thread as needed. Since it is likely that any background tasks that you run in applicationDidEnterBackground: will not be executed until this method completes, you should request additional background execution time before starting these tasks. In other words, first call beginBackgroundTaskWithExpirationHandler: and then run the task in the send queue or secondary thread.
The application also publishes a UIApplicationDidEnterBackgroundNotification notification UIApplicationDidEnterBackgroundNotification about the same time that it calls this method to give interested objects the opportunity to respond to the transition.
Kingofbliss
source share