cscsaba
cscsaba

Reputation: 35

RestKit CoreData 0.20.3 - additional check before saving the MOC after mapping finished

Is it any way to to add additional check to entity mapping? I have a returned object from the server with the same identification attribute and I need to check if last modified date is newer then my object stored in my local store. By default RestKit will overwrite my local instance if the identification attribute is the same. The mapping is done on a child context and I am trying to compare the new value from the server before the child context is saved back to parent but I can't find any easy way to intercept the merge. Any suggestion?

Upvotes: 2

Views: 367

Answers (1)

Wain
Wain

Reputation: 119031

You should look at using KVC validation for this as it will give you access to the existing object and to the new incoming values and give you the option of aborting the mapping for that specific object. Check this.

Upvotes: 1

Related Questions