开发者

CoreData: deleteObject faults on relationships when nil

开发者 https://www.devze.com 2023-01-17 12:07 出处:网络
We have a project th开发者_开发百科at has two one to many relationships. We encounter a core data fault when we try to delete the parent object. This ONLY happens if the child relationships are empty.

We have a project th开发者_开发百科at has two one to many relationships. We encounter a core data fault when we try to delete the parent object. This ONLY happens if the child relationships are empty. So for example:

A project has many to-dos and messages. If we create a project and add a message and a to-do to it, and subsequently call deleteObject on the managedObjectContext we have no problem. BUT if we create a new project and then try to call deleteObject without ever creating any to-do's or messages we run into a relationship fault.


We resolved this by changing the inverse relationship's delete rule from nullify to no-action. This makes sense since this relationship is optional.

0

精彩评论

暂无评论...
验证码 换一张
取 消