Core Data Relationships cause save error after delete

后端 未结 8 1693
粉色の甜心
粉色の甜心 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条回答
  •  -上瘾入骨i
    2020-12-29 05:17

    I just had the problem of delete fail, and landed on this question. And I've figured out my problem and thought that I'd share that too and maybe someone will have the same problem as well.

    The mistake I made is that the object (A) I am trying to delete have a relationship to another object (B) with NULL as delete rule. However, object B also have a relationship to A and it's non-optional. Therefore, when I delete A, B's relationship of A becomes null which is not allowed. When I change the delete rule to cascade and it worked.

提交回复
热议问题