Вопрос

In my app i have two entity:

enter image description here

Multiple 'Activities' has records inside. When i delete the last ActivityRecord entity in the Activities, i want to delete also Activities entity. I did 'nullify' the delete rule of whichDate but Activities not deleted.

Result is here:

enter image description here

Это было полезно?

Решение

If you want to delete an Activities when it has no more ActivityRecords then... you have to delete the Activities. There is no way to automate this in Core Data. If you don't want to have any Activities objects with no related ActivityRecords, then you need to write your own code that deletes them.

When you're going to delete an ActivityRecord, you need to check the related Activities. If it doesn't have any more activity records, delete it too.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top