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.

  • Easily preview Mermaid diagrams
  • Live update when editing in your preferred editor
  • Capture screenshots with customizable margins
  • Create PNG from the Terminal
  • Free download on the Mac 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"];