问题
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