Re: Counting instances in Core Data
Re: Counting instances in Core Data
- Subject: Re: Counting instances in Core Data
- From: Ben Trumbull <email@hidden>
- Date: Tue, 29 Apr 2008 13:57:35 -0700
> In Tiger that was the best means available, but if you're
targeting Leopard
there is a better option available:
Create your fetch request to fetch all instances of a given entity and
execute the fetch with countForFetchRequest:error: which will simply return
the number of instances/rows that match your query.
Though Steve mentioned off-list that he's targeting Tiger, I had
managed to completely forget about this method - my apologies for the
misinformation.
Well, it's probably best to ask the NSManagedObjectContext
-respondsToSelector:@selector(countForFetchRequest:error:) and use
the slow -executeFetchRequest:error: if the result is NO.
--
-Ben
_______________________________________________
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