On Jul 31, 2011, at 08:58, Jim Thomason wrote: > I have a multithreaded CoreData application. It does a lot of > calculations on the context, so it spawns off a separate thread and > creates a new ManagedObjectContext to do its work. AFAIK, I'm > following proper Best Practices for multi-threaded core data access. > This all works fine.
... > I didn't want to worry about jumping through the hoops of merging the > contexts, so I just ensure the main context is clean and saved. It > invokes saveDocument, then checks to see if the context still has > changes, and if it does it bombs out and refuses to continue, assuming > that the save failed for some reason. You're trying to follow "Best Practices" for Core Data, but you're abusing Save. :) The problem is that I can't think of any reason why it would be acceptable for an application to save a document without the user's consent (it takes away the user's ability to, at the very least, close the document *without* saving changes, which turns the application into a ticking time bomb) ... OR ... (if you have a genuine justification for taking the Save metaphor away from the user) why you would use NSPersistentDocument at all, rather than using Core Data directly, including [NSManagedContext save:] to push your changes to the persistent store. _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
