Instance Method

applicationWillResignActive(_:)

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

Declaration

optional func applicationWillResignActive(_ application: UIApplication)

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 UIApplicationWillResignActive notification to give interested objects a chance to respond to the transition.

See Also

Responding to App State Changes and System Events

func application(UIApplication, willFinishLaunchingWithOptions: [UIApplicationLaunchOptionsKey : Any]? = nil)

Tells the delegate that the launch process has begun but that state restoration has not yet occurred.

func application(UIApplication, didFinishLaunchingWithOptions: [UIApplicationLaunchOptionsKey : Any]? = nil)

Tells the delegate that the launch process is almost done and the app is almost ready to run.

func applicationDidFinishLaunching(UIApplication)

Tells the delegate when the app has finished launching. Don’t use. Instead, use application(_:didFinishLaunchingWithOptions:).

func applicationDidBecomeActive(UIApplication)

Tells the delegate that the app has become active.

func applicationDidEnterBackground(UIApplication)

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

func applicationWillEnterForeground(UIApplication)

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

func applicationWillTerminate(UIApplication)

Tells the delegate when the app is about to terminate.

func applicationProtectedDataWillBecomeUnavailable(UIApplication)

Tells the delegate that the protected files are about to become unavailable.

func applicationProtectedDataDidBecomeAvailable(UIApplication)

Tells the delegate that protected files are available now.

func applicationDidReceiveMemoryWarning(UIApplication)

Tells the delegate when the app receives a memory warning from the system.

func applicationSignificantTimeChange(UIApplication)

Tells the delegate when there is a significant change in the time.