IamAnil
IamAnil

Reputation: 496

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

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

Frequently updating Meeting managed object deletes the event managed object which has a to-one inverse relationship from meeting managed object.

Error CoreData: annotation: repairing missing delete propagation for to-many relationship meetingList on object 0x60c00009c4d0 (0x60c000621e40 ) with bad fault 0x60800009ac20 (0x60800023a360 )

Data Model

I have three entities in my core data model i.es

(CDEvent, CDMeeting, CDMLCheckin) .

Entity Properties and Relationship as described below:

Relationship enter image description here

Properties: CDEvent enter image description here CDMeeting enter image description here

CDMLCheckin enter image description here

Unique Constraint:

Relationship

Full Description : https://docs.google.com/document/d/1y2DQhBBLqjAP9eWbx5YpQhH7oVigxT_mcJDnPLlOMtQ/edit?usp=sharing

Note

Please help us here as we are struck from more than a week :(

Upvotes: 9

Views: 1567

Answers (1)

Ionescu Vlad
Ionescu Vlad

Reputation: 151

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 ?

Upvotes: 2

Related Questions