iOS7 NSMergeConflict on Single Thread Save

前端 未结 1 1242
伪装坚强ぢ
伪装坚强ぢ 2021-02-06 05:54

Am having problems with a simple data save on a single threaded app after two rows have been re-ordered.

I\'ve managed to simplify the coding to reproduce the error and

相关标签:
1条回答
  • 2021-02-06 06:28

    I had similar issues an found a workaround here:

    http://prod.lists.apple.com/archives/cocoa-dev/2013/Oct/msg00657.html

    In short - add this to your MOC setup:

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

    This affects OS X 10.9 Mavericks as well when using NSSQLStoreType. I could not repeat the Merge error using NSXMLStoreType.

    For Swift 2.x

    managedObjectContext.mergePolicy = NSMergePolicy(mergeType: .MergeByPropertyObjectTrumpMergePolicyType)
    
    0 讨论(0)
提交回复
热议问题