user4727493
user4727493

Reputation:

How to remove objects if there is no other relationships in Core Data to this object?

I have following entities in Core Data:

My relationship are described on the image below: enter image description here

My problem:

I have userA with locationA and locationB and locationC I have userB with locationA and locationD

Now inside userA I assign a new NSSet with locationB.

What happens now?

What should I do to achieve that result?

Upvotes: 2

Views: 53

Answers (1)

heximal
heximal

Reputation: 10517

No locations are removed in described case, they just become orphaned. You should fetch locations and manually delete it before assign new set or implement special method to delete all orphaned locations.

Upvotes: 1

Related Questions