Core Data NSPersistentDocument and revert
Core Data NSPersistentDocument and revert
- Subject: Core Data NSPersistentDocument and revert
- From: Erik Buck <email@hidden>
- Date: Mon, 4 Jun 2007 06:38:02 -0700 (PDT)
I recently discovered a bug regarding document revert in one of my applications.
Apple explains part of the issue at http://developer.apple.com/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/04_Department/chapter_5_section_5.html
Essentially, managed objects that have associated object controllers are problematic to clean up because the object controllers independently maintain a reference to the managed objects being controlled.
Sadly, in non-trivial cases, the recommended approach of implementing - revertToContentsOfURL:ofType:error: to call -setContent:nil for each controller is not completely working for me. I still get incorrect behavior after reverting. Stack traces show me that bindings through controllers are still attempting to access deleted managed objects.
Without getting too specific, are there any other well known clean-up issues with supporting document revert ? I considered calling -setManagedObjectContext:nil for all controllers. I have also considered releasing all of the controllers and recreating them pragmatically during revert.
For the time being, I will just have to disable the revert functionality in my application. Can anybody point me to more sample code that uses NSPersistentDocument and supports revert ?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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