Re: Core Data: Determine if managed object is deleted
Re: Core Data: Determine if managed object is deleted
- Subject: Re: Core Data: Determine if managed object is deleted
- From: Dave Fernandes <email@hidden>
- Date: Fri, 21 Oct 2011 12:57:37 -0400
On 2011-10-21, at 11:57 AM, David Riggle wrote:
> I'm currently experimenting with the following to see if it's as safe and perhaps faster:
>
> - (void)prepareForDeletion
> {
> // track object deletion for faster testing below
> NSString *objIDStr = [[[self objectID] URIRepresentation] resourceSpecifier];
> [_deletedObjectIDs addObject:objIDStr];
> }
>
> - (BOOL)retainedObjectHasBeenDeleted
> {
> NSString *objIDStr = [[[self objectID] URIRepresentation] resourceSpecifier];
> return [_deletedObjectIDs containsObject:objIDStr];
> }
>
> Unfortunately _deletedObjectIDs grows without bound. So you wouldn't want to use this approach if you are expecting a lot of deletions.
This also wouldn't work if you can undo deletions._______________________________________________
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