Key data: how to remove entities in relationships

I have a complex graph of Core Data on iPhone. A user object has many other objects that are related to each other with several relationships, etc.

My question is how to delete all related objects when I delete a custom object.

Thanks in advance!

+3
source share
2 answers

In the user entity, set the cascade value for each relationship deletion rule.

Also see this answer in iPhone Master Data: Cascading Multi-to-One Deletion .

+4

. , , , . , . node.

,

user--(phoneNumbers,Cascade)->>phoneNumber
user<--(user,nullify)--phoneNumber

, . .

...

- ( , Cascade) β†’ > PHONENUMBER - ( , Cascade) β†’ > areaCodes

... ,

+3

Source: https://habr.com/ru/post/1736349/


All Articles