RestKit and synchronization

53 views
Skip to first unread message

gilles...@belighted.com

unread,
Oct 9, 2014, 3:04:16 AM10/9/14
to res...@googlegroups.com
Hello, 

I've now been using RestKit for the past two months and I must say I'm quite impressed with the possibilities it provides.

I'm trying to provide a basic way to synchronize data with a remote web server.

The posting of locally created object is trivial: I just nil my local objects and then post them at a later time, then get back the id from the server and attribute an id to my local object based on that response. 


The part where I'm really struggling is for the update merge code. Basically, I do not want granular control on what needs to be updated and what shouldn't.

From the server, I'm able to get all objects that have been updated or created since my last synchronization date.
Locally, it's also trivial to get all objects that have been updated.

I then need to compare those two sets of items, update locally when the server changes are more recent, and patch the remote objects in the opposite case.

I first tried using two RKManagedObjectStores, one with linked to an sqlite store coordinator, the other an in memory store to get objects from the remote server.

The main issue I'm facing is that I cannot easily plug data from two different contexts.

It's true that I can manually do that merge using more manual comparisons, but this kind of defeats the purpose of using RestKit.

Is there a better way to do what I'm trying to achieve?

Thanks in advance for your help.
Reply all
Reply to author
Forward
0 new messages