---
title: "application(_:shouldRestoreSecureApplicationState:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiapplicationdelegate/application(_:shouldrestoresecureapplicationstate:)"
---

# application(_:shouldRestoreSecureApplicationState:)

Asks the delegate whether to restore the app’s saved state.

## Declaration

```swift
optional func application(_ application: UIApplication, shouldRestoreSecureApplicationState coder: NSCoder) -> Bool
```

## Parameters

- `application`: The singleton app object.
- `coder`: A keyed archiver containing the app’s previously saved state. The coder’s doc://com.apple.documentation/documentation/Foundation/NSCoder/requiresSecureCoding property is set to doc://com.apple.documentation/documentation/Swift/true, and any objects you decode must adopt doc://com.apple.documentation/documentation/Foundation/NSSecureCoding.

## Return Value

Return Value true to restore the app’s saved state; otherwise, false.

## Discussion

Discussion Apps must implement both this method and application(_:shouldSaveSecureApplicationState:) for state preservation to occur. Use the information from the provided coder to determine whether to proceed with state restoration. For example, you might return false if the data in the coder is from an earlier version of your app and you can’t restore it safely. Any objects you decode from the coder must adopt the NSSecureCoding protocol. This method supersedes application(_:shouldRestoreApplicationState:). If your delegate implements both methods, the system only calls this one.

## See Also

### Managing app state restoration

- [application(_:shouldSaveSecureApplicationState:)](uikit/uiapplicationdelegate/application(_:shouldsavesecureapplicationstate:).md)
- [application(_:viewControllerWithRestorationIdentifierPath:coder:)](uikit/uiapplicationdelegate/application(_:viewcontrollerwithrestorationidentifierpath:coder:).md)
- [application(_:willEncodeRestorableStateWith:)](uikit/uiapplicationdelegate/application(_:willencoderestorablestatewith:).md)
- [application(_:didDecodeRestorableStateWith:)](uikit/uiapplicationdelegate/application(_:diddecoderestorablestatewith:).md)
- [stateRestorationBundleVersionKey](uikit/uiapplication/staterestorationbundleversionkey.md)
- [stateRestorationSystemVersionKey](uikit/uiapplication/staterestorationsystemversionkey.md)
- [stateRestorationTimestampKey](uikit/uiapplication/staterestorationtimestampkey.md)
- [stateRestorationUserInterfaceIdiomKey](uikit/uiapplication/staterestorationuserinterfaceidiomkey.md)
- [stateRestorationViewControllerStoryboardKey](uikit/uiapplication/staterestorationviewcontrollerstoryboardkey.md)
