Core Data multi-threading

Posted by JK on Stack Overflow See other posts from Stack Overflow or by JK
Published on 2010-04-14T12:04:43Z Indexed on 2010/04/14 12:43 UTC
Read the original article Hit count: 461

Filed under:
|
|
|
|

My app starts by presenting a tableview whose datasource is a Core Data SQLite store. When the app starts, a secondary thread with its own store controller and context is created to obtain updates from the web for data in the store. However, any resulting changes to the store are not notified to the fetchedresults controller (I presume because it has its own coordinator) and consequently the table is not updated with store changes. What would be the most efficient way to refresh the context on the main thread? I am considering tracking the objectIDs of any objects changed on the secondary thread, sending those to the main thread when the secondary thread completes and invoking "[context refreshObject:....] Any help would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocoa-touch