Core Data (After Adding Unique Constraint) : annotation: repairing missing delete propagation for to-many relationship

后端 未结 1 1627
醉梦人生
醉梦人生 2021-02-14 17:56

This issue started occurring after we added Unique key i.es Constraint.

Frequently updating Meeting managed object deletes the event manage

1条回答
  •  礼貌的吻别
    2021-02-14 18:57

    I hope I can help, having a unique constraint with To-Many Relationship Entities you need to keep some points in mind

    • Use Inverse Relationship of every CoreData relation
    • Unique Constrains Attributes should never be Optional

    When you create NSManagedObjectContext make sure you set MergePolicy.

    [_context setMergePolicy: mergePolicy];

    • NSMergeByPropertyStoreTrumpMergePolicy

    • NSMergeByPropertyObjectTrumpMergePolicy

    • NSOverwriteMergePolicy

    Also could you try changing the nullify delete rule to no action ?

    0 讨论(0)
提交回复
热议问题