zumzum
zumzum

Reputation: 20238

Core Data merge​By​Property​Store​Trump​Merge​Policy​Type, what does it mean?

Documentation says:

case merge​By​Property​Store​Trump​Merge​Policy​Type Specifies a policy that merges conflicts between the persistent store’s version of the object and the current in-memory version, giving priority to external changes.

So, I am not sure what they mean with "giving priority to external changes."

I am trying to figure out what happens with this policy when I have a context set to that policy, on saving the context if there is a merge conflict, does the context's version get saved or does the store keep the version of the object it already have? So, does the context win or the store win?

Upvotes: 1

Views: 1101

Answers (1)

timaktimak
timaktimak

Reputation: 1380

NSMerge​By​Property​Store​Trump​Merge​Policy doc says:

The merge occurs by individual property. For properties that have been changed in both the external source and in memory, the external changes trump the in-memory ones.

NSMerge​By​Property​Object​Trump​Merge​Policy doc says:

The merge occurs by individual property. For properties that have been changed in both the external source and in memory, the in-memory changes trump the external ones.

So, external means the data from the store. In the first case the store keeps its data, in the second the data is overwritten with the context version of the object.

Hope this helps!

Upvotes: 7

Related Questions