Skip navigation.
 
mlCoreData and NSOperation
FROM : Alexander Griekspoor
DATE : Wed Jan 30 23:40:25 2008

Hi,

We know about core data and multi-threading, that you need one 
NSManagedObjectContext per thread to prevent trouble saving/accessing 
managed objects concurrently. How about NSOperation? Does the same 
apply there? Say I want to parse a big file into managedobjects, I 
would chunk it into pieces and have each piece be processed by an 
NSOperation. However, after processing it should end up as an 
NSManagedObject with a bunch of properties, all saved in one 
persistent store. Can you simply create a new object in the central 
MOC shared between all operations or do you need again one MOC per 
NSOperation, with the appropriate refreshing of your central MOC to 
update the UI? And what about saving your MOC at the end of each 
operation or should you wait till all operations have completed? I 
guess that depends one the one vs many MOCs as well. Any advise would 
be welcome!
Thanks,
Alex

**********************************************
          ** Alexander Griekspoor  PhD **
**********************************************
          mekentosj.com

  Papers - Your Personal Library of Science
  2007 Winner of the Apple Design Awards
          Best Mac OS X Scientific Solution
          http://www.mekentosj.com/papers
**********************************************

Related mailsAuthorDate
mlCoreData and NSOperation Alexander Griekspo… Jan 30, 23:40
mlre: CoreData and NSOperation Ben Trumbull Jan 31, 01:38
mlRe: CoreData and NSOperation Alexander Griekspo… Jan 31, 11:36
mlRe: CoreData and NSOperation Chris Kane Feb 1, 20:17