Prevent “Resume” for my Cocoa application?

后端 未结 1 2019
执念已碎
执念已碎 2020-12-19 07:11

I love the new \"Resume\" feature in Lion. After a restart window size and position is exactly how you left it. But during development this is a bit annoying. If I resize a

1条回答
  •  北海茫月
    2020-12-19 07:53

    Yes. As documented in the Lion AppKit release notes, you can set the ApplePersistenceIgnoreState user default for your application. (The docs imply that the value isn't significant; it just needs to be set to something.)

    An easy way to do this for debug runs only, while preserving the state restoration feature when you use your app normally, is to set it in Xcode. In your scheme's Run action, set a command-line argument for -ApplePersistenceIgnoreState, and, immediately after it, another one with the value (e.g., YES). This makes use of AppKit's feature of reading user defaults from the command-line.

    0 讨论(0)
提交回复
热议问题