Skip to content

NSMergeConflict CoreData Crash in iOS 7

data_coredataI kept getting an error like this…

NSCocoaErrorDomain Code=133020 “The operation couldn’t be completed. (Cocoa error 133020.)” UserInfo=0x1115a6d0 {conflictList=(

“NSMergeConflict (0x1115a670) for NSManagedObject

 

I chased the bug for a while looking at all types of threading issues. In the end, it was just that my background context didn’t have a merge policy set on it…

context setMergePolicy:NSMergeByPropertyObjectTrumpMergePolicy];

In many cases, it’s a bit disappointing after testing, researching, reading, trying, etc. to find the fix to be so small and simple. However, I’m sure we’d all agree that’s better than having to redesign a large part of our source code.

See http://stackoverflow.com/questions/19178972/nsmergeconflict-on-ios7