Hi Steve,

On Apr 12, 2013, at 1:10 PM, Steve Mills <[email protected]> wrote:

> If I have an unsaved doc open in my app (I mean one that has never been saved 
> to disk), and I kill the app, upon relaunch, the OS attempts to restore that 
> document, but it does so incorrectly. First of all, the data was never saved 
> by the new Cocoa autosaving mechanism (we have our own and must use it for 
> now). Second, it creates a new untitled doc by calling our document 
> controller's openUntitledDocumentAndDisplay method. Why would it do that? A 
> new untitled doc with nothing in it has *nothing* to do with what might've 
> been an untitled doc with user changes in it.

If the app unexpectedly crashed or was killed, the system will make a 
best-effort to restore state. If the document was never saved, the best it can 
do is recreate an Untitled document.

> Also, what should I be overriding and returning in my document subclass to 
> ensure that the OS autosaving never happens and prevent it from trying to 
> create new docs on launch like this?

You can mark a window as not restorable in the xib, or by calling [window 
setRestorable:NO]

Hope that helps,
-Peter
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to