Post

Replies

Boosts

Views

Activity

Reply to NSManagedObjectContext save leads to _thereIsNoSadnessLikeTheDeathOfOptimism
Currently I am using a fixed number of NSManagedObjectContext objects: 1 for writing, 2 for reading. All of them are background contexts created with newBackgroundContext() method and merge policy is set to NSMergeByPropertyObjectTrumpMergePolicy. Based on this setup, it seems like CoreData should always be able to resolve unique constraints when data is being inserted. I wonder, if this failure could be avoided by using a custom merge policy? It feels like based on my setup CoreData implies that such unique constraints issue should not happen and that is why it leads to a crash.
Sep ’24