applicationWillResignActive(_:)
Tells the delegate that the app is about to become inactive.
Declaration
optional func applicationWillResignActive(_ application: UIApplication)Parameters
- application:
Your singleton app object.
Mentioned in
Discussion
UIKit calls this method to let your app know that it is about to move from the active to inactive state. The app moves to the inactive state because of temporary interruptions like 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 doesn’t dispatch incoming events to responders.
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 to ensure that it isn’t 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. Don’t rely on specific app state transitions to save all of your app’s critical data.
After calling this method, UIKit also posts a willResignActiveNotification to give interested objects a chance to respond to the transition.