This issue started occurring after we added Unique key i.es Constraint.
经常更新会议管理对象会删除与会议管理对象具有一对一反比关系的事件管理对象.
Error CoreData: annotation: repairing missing delete propagation for to-many relationship meetingList on object 0x60c00009c4d0 (0x60c000621e40 ) with bad fault 0x6
This issue started occurring after we added Unique key i.es Constraint.
09ac20 (0x6
This issue started occurring after we added Unique key i.es Constraint.
23a360 )
数据模型
我的核心数据模型中有三个实体
(CDEvent,CDMeeting,CDMLCheckin) .
实体属性和关系如下所述:
属性:
CDEvent
CDMeeting
独特的约束:
> CDEvent实体将eventUUID作为唯一约束.
> CDMeeting实体将meetingUUID作为唯一约束.
关系
> CDEvent< - >> CDMeeting
>从CDEvent到CDMeeting是与删除规则级联的多对多关系,从CDMeeting到CDEvent的反向关系是与删除规则无效的一对一.
> CDEvent< - >> CDMLCheckin
>从CDEvent到CDMLCheckin与删除规则级联的多对多关系,从CDMLCheckin到CDEvent的反向关系是与删除规则无效的一对一.
完整描述:https://docs.google.com/document/d/1y2DQhBBLqjAP9eWbx5YpQhH7oVigxT_mcJDnPLlOMtQ/edit?usp=sharing
注意
>如果我从CDEvent中删除Unique Constraint eventUUID,一切正常.
请帮助我们,因为我们被打了一个多星期:(
解决方法
>使用每个CoreData关系的反向关系
>唯一约束属性永远不应该是可选的
创建NSManagedObjectContext时,请确保设置MergePolicy.
[_context setMergePolicy:mergePolicy];
> NSMergeByPropertyStoreTrumpMergePolicy
> NSMergeByPropertyObjectTrumpMergePolicy
> NSOverwriteMergePolicy
您也可以尝试将nullify删除规则更改为无操作吗?