mercredi 26 août 2015

Best approach for storing changes to an object

Currently I am using Core-Data to store data that I receive via JSON from an external API.

Each 'record' contains a bunch of relationships and other associated data.

While the app is offline the user will make some changes, perhaps adding some images etc....

Then when the app is online the user can choose to 'sync' their changes.

What is the best approach to achieving this? I can write any changes to core data and then send back the record and its related objects but this seems like a waste of bandwidth, say if the user changes one aspect of one record, like editing its title for example, then when I press sync I'm essentially sending back all the records, irregardless of wether anything has changed.

I currently have a fetch request that queries wether I have an existing record and if so updates it..is that a possible approach to this problem? but in reverse..?

I apologise if this is seemingly vague, but I don't doubt someone has comes across this problem before, I'm struggling with the design pattern aspect of it

Aucun commentaire:

Enregistrer un commentaire