Re: Delete empty Core Data entities from to-many relationship
Re: Delete empty Core Data entities from to-many relationship
- Subject: Re: Delete empty Core Data entities from to-many relationship
- From: Jerry Krinock <email@hidden>
- Date: Sat, 14 Feb 2015 11:40:11 -0800
> On 2015 Feb 13, at 11:27, Steve Mills <email@hidden> wrote:
>
> Is there a better strategy for deleting empty container entities? At first I tried setting the Asset's folder relationship to Cascade, but that threw up all over.
Apparently the “count is never 1” because Core Data does not delete your Folder until the end of the run loop cycle.
A different approach would be maybe to register for NSObjectsChangedInManagingContextNotification. Another alternative would be to use the Cascade Delete, and I’m not sure if you’ve done that because I didn’t scrutinize all the details in your post. But that may not work as expected, as I learned in 2009…
http://lists.apple.com/archives/cocoa-dev/2009/Jun/msg01334.html
A shortcut I’ve learned is: Don't overthink Core Data. If something doesn’t work as expected, accept it and try something different.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden