问题
Our app consumes a web api and also uses core data. We are successfully using Restkit to send and receive data between the app and the database. However we are having difficulty implementing a conditional sync between the server and the app.
One of the tables on the server has an 'updated_at' field. The table corresponds to a NSManagedObject on our iOS application. We are trying to establish a means of updating the managed object on the device only if the 'updated_at' field being called from the server is newer, or later, than the one on the device.
It would appear that the RKObjectManager maps to core data before its completion block is called, and therefore does not allow us to perform the necessary synchronisation logic in the completion block.
Could someone outline generally how what we are trying to do might be achieved using Restkit, if it is possible to do so.
来源:https://stackoverflow.com/questions/24042417/time-based-sync-with-restkit