Using master data as a local cache for data retrieved from remote web services

In my project, I need to cache iOS device data received from a remote web service. The idea is that the view controller will request a cache for all document objects that it has, for example, and in the background will request an update from the web service, returning to the view controller any new document objects that it received. I am wondering if view controllers can use the NSFetchedResultsController, which retrieves all objects that meet the criteria that it can find locally in the database, and also asynchronously requests data to be updated from the web service in the background. At the same time, NSFetchedResultsController will update the database and, of course, run the didChangeObject method of the FetchedResultsController delegate so that the views can be updated accordingly.Does that sound reasonable? Do you have any suggestions for implementing such a thing?

+5
source share
1 answer

For our project, we ultimately were able to simplify the problem a bit. However, on the way to discovery, we came across an NSIncrementalStore, which is only a ticket for the problem posed in the question. This essentially gives you control over how and where the CD stores data. Here's a really good post about this , and an easy-to-understand example . Admittedly, there aren't many doco around, but these posts really helped me get away.

+6
source

All Articles