Synchronize IOS core data with web service?

Viewed 4191

Here is my problem:

  • I want to use core data - speed and connectivity issues to build my IOS app. The data stored in core data is coming from a SQLServer database which I can access through a yet-to-be-defined web service.
  • Any changes to the data stored in core data needs to be synchronized with the SQLServer via a web service. In addition, I need to buffer changes that don't get synchronized because of connectivity issues.
  • I also need to update core data with any changes that have occured on the server. This could happen on a schedule set in user preferences.

Solutions I've Explored:

  • Using NSIncrementalStore class (new in IOS 5). I'm very confused on what this does exactly but it sounds promising. From what I can tell, you subclass NSIncrementalStore which allows you to intercept the regular core data API calls. I could then pass on the the information to core data as well as sync it with the external database via a web service. I could be completely wrong. But assuming I'm right, how would I sync deltas if the connection to the internet is down?
  • AFIncrementalStore - This is a subclass off of NSIncrementalStore using AFNetworking to do the web services piece.
  • RestKit - I'm a little concerned on how active this API is and it seems to be going through a transition to block functionality. Has anyone used this extensively?

I'm leaning towards AFIncrementalStore since this is using (what seems to be) a more standard approach. The problem is, I could be completely off on what NSIncrementalStore really is.

A link to some sample code or tutorial would be great!

2 Answers
Related