How to save objects using Multi-Threading in Core Data?

Posted by Konstantin on Stack Overflow See other posts from Stack Overflow or by Konstantin
Published on 2010-03-16T23:27:53Z Indexed on 2010/03/16 23:31 UTC
Read the original article Hit count: 262

I'm getting some data from the web service and saving it in the core data. This workflow looks like this:

  1. get xml feed
  2. go over every item in that feed, create a new ManagedObject for every feed item
  3. download some big binary data for every item and save it into ManagedObject
  4. call [managedObjectContext save:]

Now, the problem is of course the performance - everything runs on the main thread. I'd like to re-factor as much as possible to another thread, but I'm not sure where I should start. Is it OK to put everything (1-4) to the separate thread?

© Stack Overflow or respective owner

Related posts about core-data

Related posts about iphone-sdk