Hi,

I have a problem with autosavesInPlaces and my package document and reverting changes. The setup first:

All of the following methods in my NSDocument subclass return YES

+ (BOOL)autosavesInPlace
+ (BOOL)autosavesDrafts
- (BOOL)canAsynchronouslyWriteToURL:::
- (BOOL)checkAutosavingSafetyAndReturnError:

+ (BOOL)preservesVersions

returns NO

I also have "Ask to keep changes when closing documents" turned on in the system preferences.

Lets say I have a document (package) saved on disk, lets call it state A.

When I make a change to my document model , a few seconds later the auto-save kicks in, replacing the original. That is expected. This is state B.

When I don't manually use "File > Save" and quit the application, I get a "Revert Changes" panel for the document. Expected too.

Then I select "Revert Changes" and the app quits. What I expect to find on disk is State A. But what is actually there is state B.

Actually I'm not sure my document saving to a package has anything to do with 
it.

I looked at what happens when the application quits and

- (BOOL)revertToContentsOfURL:ofType:error:

is called. The absoluteURL passed in is the original file URL. So it's not surprising that this call doesn't actually revert any change. It's the latest version that autosave put there, overwriting the original.

Do I have to use +preservesVersions=YES make this work (this means, reverting actually does what it says)? I don't want my app to have that feature, but if it's a file-system background-only thing, then I just might.

Best Regards
Markus

--
__________________________________________
Markus Spoettl
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to