Prevent Resume for my Cocoa app?

I like the new Resume feature in Lion. After the size and position of the restart window is exactly how you left it. But during development, this is a bit annoying. If I resized the window in the interface builder and restarted the application, it has a new size, but the old size.

In the past, you had to set the AUTOSAVE property to get this behavior, but with Resume it all happens automatically. Is there any way to disable renewal for my application?

+6
source share
1 answer

Yes. Since it is documented in the Lion AppKit release notes , you can set the user to default ApplePersistenceIgnoreState . (The documents imply that the value does not matter, you just need to install something).

An easy way to do this is for debugging runs only, while maintaining the state recovery function during normal use of the application, is to install it in Xcode. In your Run Action program, specify a command-line argument for -ApplePersistenceIgnoreState , and immediately after it, another with a value (for example, YES ). This uses the AppKit function to read custom defaults from the command line.

+10
source

Source: https://habr.com/ru/post/897588/


All Articles