User defaults and Disable state restoration


Just a quick question re: editing the scheme and checking ‘Disable state restoration’. If this is checked the output log says:

“ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /blah”

Does this then stop the apps plist from being updated during testing? I have found that when I run the application in this mode, the next time I run it my preference changes have not been saved (I am guessing this is due to it not saving the existing state). However, when I archive the application and run this version it works as intended (obviously with no restrictions on state restoration as per the run build).

This was just a little confusing when testing because it kept opening a window on load even though I had unchecked the box. On investigation I noticed it wasn’t saving these changes between application runs.


This is a new thing since Lion and above.

State refers to the windows open, their position sizing etc…

A good example is if Safari crashes, and you fire it up again. It asks you ‘do you want to reopen all windows from last session’. That’s the state being stored.

I’m not sure about the plist files, but I assume that this is included in the application state as sharedUserDefaults comes under NSApplication.