How to properly cascade delete managed objects in Core Data?

為{幸葍}努か 提交于 2019-11-30 11:31:37

I'm certainly no Core Data expert, but reading the documentation on the various delete rule options, it seems to me that you want the B -> C relationship to be Nullify, rather than No Action. Perhaps the Bs aren't going away because the Cs are still holding references to them?

Based on the

Any relationships belonging to C's whose associated B's were deleted, are also removed Suggests that the B-C should also have Cascade.

Further, if B is removed, then C's should also be deleted. Again Cascade.

  • Nullify is often used as an inverse deletion rule*

ie. Bs relationship to A is Nullify. C relationship to B is Nulllify. Such that when C is deleted, B is NOT deleted. And when B is deleted; A is NOT deleted.

As in this winning drawing.

A--->>B Cascade <---- Nullify

B--->>C Cascade <---- Nullify

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!