问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/18716502/restkit-coredata-0-20-3-additional-check-before-saving-the-moc-after-mapping-f