Instance Method

applicationWillResignActive:

Tells the delegate that the app is about to become inactive.

Declaration

- (void)applicationWillResignActive:(UIApplication *)application;

Parameters

application

Your singleton app object.

Discussion

This method is called to let your app know that it is about to move from the active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the app and it begins the transition to the background state. An app in the inactive state continues to run but does not dispatch incoming events to responders.

You should use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. An app in the inactive state should do minimal work while it waits to transition to either the active or background state.

If your app has unsaved user data, you can save it here to ensure that it is not lost. However, it is recommended that you save user data at appropriate points throughout the execution of your app, usually in response to specific actions. For example, save data when the user dismisses a data entry screen. Do not rely on specific app state transitions to save all of your app’s critical data.

After calling this method, the app also posts a UIApplicationWillResignActiveNotification notification to give interested objects a chance to respond to the transition.

See Also

Responding to App Life-Cycle Events

- applicationDidBecomeActive:

Tells the delegate that the app has become active.

- applicationDidEnterBackground:

Tells the delegate that the app is now in the background.

- applicationWillEnterForeground:

Tells the delegate that the app is about to enter the foreground.

- applicationWillTerminate:

Tells the delegate when the app is about to terminate.

UIApplicationDidBecomeActiveNotification

Posted when the app becomes active.

UIApplicationDidEnterBackgroundNotification

Posted when the app enters the background.

UIApplicationWillEnterForegroundNotification

Posted shortly before an app leaves the background state on its way to becoming the active app.

UIApplicationWillResignActiveNotification

Posted when the app is no longer active and loses focus.

UIApplicationWillTerminateNotification

Posted when the app is about to terminate.