9
votes

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:

  • CDEvent entity has eventUUID as unique constraint.
  • CDMeeting entity has meetingUUID as unique constraint.

Relationship

  • CDEvent <->>CDMeeting
    • From CDEvent to CDMeeting is to-many relationship with delete rule cascade, inverse relationship from CDMeeting to CDEvent is to-one with delete rule nullify.
  • CDEvent <->>CDMLCheckin
    • From CDEvent to CDMLCheckin is to-many relationship with delete rule cascade, inverse relationship from CDMLCheckin to CDEvent is to-one with delete rule nullify.

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

Note

  • If i remove Unique Constraint eventUUID from CDEvent everything works fine.

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

1
Same issue, even i am also facing. If anyone know the solution kindly help me.....nagarajan

1 Answers

2
votes

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 ?