I have a Core data model like the User Entity having relationship with multiple entities. I need to delete all the entities that is related to User entity when i try to remove the user in core data.
How to achieve this?
The easies way is to go to all the relationships in the Core Data model editor, select each and choose the Delete Rule
(which is preset to Nullify
) to be Cascade
.
Now all depending entities will be deleted as well.
Here is the relevant section in the Core Data Programming Guide.