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
- Live update when editing
- Capture screenshots
- Create PNG from the Terminal
- Free download on the Mac App Store
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"];