application(_:shouldSaveApplicationState:)
Asks the delegate whether to preserve the app’s state.
Declaration
optional func application(_ application: UIApplication, shouldSaveApplicationState coder: NSCoder) -> BoolParameters
- application:
Your singleton app object.
- coder:
The keyed archiver into which you can put high-level state information.
Return Value
true if the app’s state should be preserved; otherwise, false.
Discussion
Apps must implement this method and the application(_:shouldRestoreApplicationState:) method for state preservation to occur. In addition, your implementation of this method must return true each time UIKit tries to preserve the state of your app. You can return false to disable state preservation temporarily. For example, during testing, you could disable state preservation to test specific code paths.
You can add version information or any other contextual data to the provided coder object as needed. During restoration, you can use that information to help decide whether or not to proceed with restoring your app to its previous state.
See Also
Deprecated
application(_:didRegister:)application(_:didReceive:)application(_:didReceiveRemoteNotification:)application(_:handleActionWithIdentifier:for:completionHandler:)application(_:handleActionWithIdentifier:for:withResponseInfo:completionHandler:)application(_:handleActionWithIdentifier:forRemoteNotification:completionHandler:)application(_:handleActionWithIdentifier:forRemoteNotification:withResponseInfo:completionHandler:)application(_:handleOpen:)application(_:open:sourceApplication:annotation:)application(_:willChangeStatusBarOrientation:duration:)application(_:didChangeStatusBarOrientation:)application(_:willChangeStatusBarFrame:)application(_:didChangeStatusBarFrame:)application(_:handle:completionHandler:)application(_:performFetchWithCompletionHandler:)