The State Preservation and Restoration system is well documented here: Preserving Your App’s Visual Appearance Across Launches.

But what is not well known is that there is a secret preference to enable debug logs.

Want to support this blog? Please check out

  • Easily preview Mermaid diagrams
  • Sequence diagrams, flowcharts, …
  • Built-in editor
  • Export to PDF, PNG, and SVG
  • Quick Look integration
  • Available on macOS, iOS, and iPadOS
  • Free download on the App Store
MarkChart

You can set the preference UIStateRestorationDebugLogging to YES in your main function before the call to UIApplicationMain:

[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"UIStateRestorationDebugLogging"];

There is also a less useful ‘Developer Mode’ secret preference which will skip the deletion of the restoration archive when the app crashes. To enable this mode set the preference UIStateRestorationDeveloperMode to YES in your main function before the call to UIApplicationMain:

[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"UIStateRestorationDeveloperMode"];