Open GabrielHauber opened 3 years ago
Ok it turns out to have been a CoreData setup issue. The persistence SDK was doing the right thing in setting the new relationships, and even examining them before / after they were right, but the problem was in merging from background context to the view context.
i.e. Sync was performed on a background context using the default merge policy to the view context. This meant that the changes were merged, not overwriting, leaving both old & new relationships on a to-many entity relationship.
The fix was explicitly setting persistentContainer.viewContext.mergePolicy = NSMergePolicy.overwrite
before performing the sync in the background.
This is the problem I'm having, and I think it's on the Contentful sync side…
The problem is this: