In case anyone else hits this, I 'solved' it by setting a merge policy on the 
managed object context:

  [_managedObjectContext setMergePolicy:[[NSMergePolicy alloc] 
initWithMergeType:NSMergeByPropertyObjectTrumpMergePolicyType]];

This very much feels like a workaround. According to the documentation

-------
Problem: You see the error message, "Could not merge changes".

Cause: Two different managed object contexts tried to change the same data. 
This is also known as an optimistic locking failure.

Remedy: Either set a merge policy on the context, or manually 
(programmatically) resolve the failure. You can retrieve the currently 
committed values for an object usingcommittedValuesForKeys:, and you can 
re-fault the object (so that when it is next accessed its data values are 
retrieved from its persistent store) usingrefreshObject:mergeChanges:.
-------


Still, I wonder why this happens in 10.9 but not in 10.6-10.8.

Cheers,

Martin




On 25 Oct 2013, at 08:46 pm, Martin Hewitson <martin.hewit...@aei.mpg.de> wrote:

> Dear list,
> 
> I have two different core data apps, both of which are exhibiting similar 
> behaviour in that they sometimes (for some changes in some properties) can’t 
> save the MOC. Here is an example error I get when using
> 
> [moc save:error]
> 
> Error Domain=NSCocoaErrorDomain Code=133020 "Could not merge changes." 
> UserInfo=0x7feb8e2edf90 {conflictList=(
>    "NSMergeConflict (0x7feb8e2d68b0) for NSManagedObject (0x7feb8e07d610) 
> with objectID '0x54000ab 
> <x-coredata://DE6DE351-C155-4C70-A1CB-3BFEAA0AE69C/Theme/p21>' with 
> oldVersion = 22 and newVersion = 23 and old object snapshot = {\n    color = 
> <62706c69 73743030 d4010203 04050615 16582476 65727369 6f6e5824 6f626a65 
> 63747359 24617263 68697665 72542474 6f701200 0186a0a3 07080f55 246e756c 
> 6cd3090a 0b0c0d0e 554e5352 47425c4e 53436f6c 6f725370 61636556 24636c61 
> 73734f10 28302e37 30353838 32333730 3520302e 31313736 34373035 39332030 
> 2e303339 32313536 38373636 00100180 02d21011 12135a24 636c6173 736e616d 
> 65582463 6c617373 6573574e 53436f6c 6f72a212 14584e53 4f626a65 63745f10 
> 0f4e534b 65796564 41726368 69766572 d1171854 726f6f74 80010811 1a232d32 
> 373b4148 4e5b628d 8f9196a1 aab2b5be d0d3d800 00000000 00010100 00000000 
> 00001900 00000000 00000000 00000000 0000da>;\n    name = Discussion;\n} and 
> new cached row = {\n    color = <62706c69 73743030 d4010203 04050615 16582476 
> 65727369 6f6e5824 6f626a65 63747359 24617263 68697665 72542474 6f701200 
> 0186a0a3 07080f55 246e756c 6cd3090a 0b0c0d0e 554e5352 47425c4e 53436f6c 
> 6f725370 61636556 24636c61 73734f10 28302e37 30353838 32333730 3520302e 
> 31313736 34373035 39332030 2e303339 32313536 38373636 00100180 02d21011 
> 12135a24 636c6173 736e616d 65582463 6c617373 6573574e 53436f6c 6f72a212 
> 14584e53 4f626a65 63745f10 0f4e534b 65796564 41726368 69766572 d1171854 
> 726f6f74 80010811 1a232d32 373b4148 4e5b628d 8f9196a1 aab2b5be d0d3d800 
> 00000000 00010100 00000000 00001900 00000000 00000000 00000000 0000da>;\n    
> name = Discussion;\n}"
> )}
> 
> Both apps are fairly bog-standard core data shoe box apps which have been 
> working fine since 10.6. These problems just started to appear on 10.9.
> 
> Any ideas what I can try or what might have changed to cause these problems?
> 
> Many thanks,
> 
> Martin







_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to