Re: Autosaving in an NSPersistentDocument
Re: Autosaving in an NSPersistentDocument
- Subject: Re: Autosaving in an NSPersistentDocument
- From: Quincey Morris <email@hidden>
- Date: Sat, 19 Jul 2008 13:14:10 -0700
On Jul 19, 2008, at 11:22, Rick Mann wrote:
Can someone please explain this part of the NSPersistentDocument docs?
"Although this tutorial does not aim to cover all the possible
features you might implement in an application, some functionality
is omitted due to limitations in NSPersistentDocument itself.
Because of the way Core Data operates, it is not possible to easily
support autosaving in anNSPersistentDocument-based application. Core
Data cannot save to a store and maintain the same changed state in a
managed object context, all while keeping an unsaved stack around as
the current document. For similar reasons, NSPersistentDocument does
not support Save To operations."
http://developer.apple.com/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/01_Task/chapter_2_section_4.html#/
/apple_ref/doc/uid/TP40002829-SW5
What do they mean by auto-save?
I seem to be able to save my document (from the app's Save menu
item), and the Undo command is still available. I don't understand
how I can save manually, but it couldn't save automatically, and I
don't get the bit about "all while keeping an unsaved stack around".
Autosave is a fairly new capability of NSDocument that makes temporary
backup copies of your document before you officially save it. You can
see it in operation in TextEdit.
Autosave requires a "save-to" operation (as opposed to a simple save
or a "save-as") because you don't want your document to appear saved
to the user until it's explicitly saved by the user using a save or
"save-as". After autosaving, the document is still "dirty" and the
user can still revert to the last user-saved version. After a save or
"save-as", the document is clean.
"Save-to" (and hence autosave, and the File menu's Save A Copy As ...
that you see in some applications) isn't available in
NSPersistentDocument, because Core Data can't write the current state
of its document to disk without literally saving it first. That's a
technical limitation of the way it uses persistent stores.
Undo doesn't really figure into this, because most Cocoa applications
allow you to undo beyond the last save. (This was not always true. In
the bad old days, saving a file caused all undo actions to be
discarded.)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden