That was the suggestion I needed.  Thank you.  Here's what I did in the 
windowControler:

[doc removeWindowController:self];
[[self managedObjectContext] rollback];
[doc close];

and then I use my normal routine to reload the document. 

On Jun 29, 2010, at 12:23 PM, Jerry Krinock wrote:

> 
> 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 (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:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev%40softraph.com
> 
> This email sent to cocoa-...@softraph.com

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to