a paid nerd
a paid nerd

Reputation: 31532

Get rid of "Do you want to try to reopen its windows again?" dialogs

I'm building a Cocoa application with Xcode. I have to force-kill my app for unrelated reasons, and every time I do I get this popup:

The last time you opened MyApp, it unexpectedly quit while reopening windows. Do you want to try to reopen its windows again?

If you choose not to reopen windows, you may have to open and position the windows yourself.

[Don't Reopen] [Reopen]

What is this system called and how can I disable it for my application?

Upvotes: 5

Views: 1631

Answers (1)

Joshua Nozzi
Joshua Nozzi

Reputation: 61228

This is Cocoa's automatic state restoration in action. You can suppress it when your app is launched under Xcode by editing your active scheme, choosing the Run action, and checking "Launch application without state restoration".

Disabling state restoration in your app's scheme

Note: Disabling this will also disable automatically-reopening documents that were opened previously, which can be a pain for testing a document-based application, since you'll have to re-open the doc manually each time you run it. This also only disables state restoration while being run under Xcode under that particular scheme.

Upvotes: 4

Related Questions