iOS: RESTKit sync data with CoreData

不问归期 提交于 2019-12-13 03:04:34

问题


Setup: RESTFull API with MySQL Database in the Backend.

I'm using RESTKit v.20.3 to make the API calls. I'm about to switch to Core Data.

Question:

If I have 10 objects in the remote database and I fetch for the first time using GET, I will get all 10 objects back and stored in Core Data locally. When I make subsequent fetch requests, how do I tell RESTKit to only download new objects only and not the same 10 objects that it downloaded earlier? Best practice approach please!


回答1:


First, use the latest version of RestKit (check github).

Second, this is a question about the web service offered by the server, not RestKit or your client specifically. Generally, when you make a request you should store the date you made it, and as part of the request you should pass the last request date so the server can filter to find the appropriate data to return. Technically, you should only store the request date when you receive a valid response from the server...



来源:https://stackoverflow.com/questions/22737308/ios-restkit-sync-data-with-coredata

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!