Core Data Relationships cause save error after delete

后端 未结 8 1699
粉色の甜心
粉色の甜心 2020-12-29 04:37

This question is probably a long shot. I can\'t figure out the errors I\'m getting on my core data project when I save after I delete an entity.

I have two main enti

8条回答
  •  情歌与酒
    2020-12-29 05:30

    Do you happen to implement some of the accessor to the relationship yourself? I once had a code like

    -(NSSet*)articles
    {
           re-calculates properties....
           return [self primitiveValueForKey:@"articles"];
    }
    

    in a subclass of NSManagedObject and had a save error. What happened was that, when this object is deleted from the ManagedObjectContext, the CoreData calls the accessor "articles" to deal with the delete propagation. This re-calculation of articles occurred during the delete propagation, which re-surrected the nullified "articles" in my case.

提交回复
热议问题