Re: How to revert to an unedited document & window?
Re: How to revert to an unedited document & window?
- Subject: Re: How to revert to an unedited document & window?
- From: Jerry Krinock <email@hidden>
- Date: Tue, 29 Jun 2010 09:23:03 -0700
On 2010 Jun 29, at 05:23, Brad Stone wrote:
> Using [NSPersistentDocument revertToContentsOfURL:(NSURL *)inAbsoluteURLofType:(NSString *)inTypeName error:(NSError**)outError] works except the window closes and opens. If that didn't happen I'd be fine.
Reverting a Core Data document is tricky. Apple's recommended methods are given here:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/04_Department/department.html#//apple_ref/doc/uid/TP40002832-SW6
But you should also read these:
http://www.cocoabuilder.com/archive/cocoa/161579-bug-in-nspersistentdocument-tutorial.html#161579
http://www.cocoabuilder.com/archive/cocoa/174292-bug-nspersistentdocument-core-data-tutorial.html#174292
http://www.cocoabuilder.com/archive/cocoa/177523-bug-nspersistentdocument-core-data-tutorial.html#177523
Since "Revert" is not a major advertised feature of the app I was working on, after trying unsuccessfully to make it work for an hour or so, I gave up and implemented Revert to simply close and re-open the document. It's a little slow and ugly, but it works, and eliminates a branch of regression possibilities.
_______________________________________________
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