Reputation: 6279
as I have seen there are several possibilities to get an object count in core data(when I say an object count I mean the object count and just only the object count).
If I set resultType
to NSCountResultType
, then what is better to do, executeFetchRequest:error:
or countForFetchRequest:error:
? Does the values of includesPropertyValues
and includesSubentities
care?
Thanks
Upvotes: 3
Views: 1881
Reputation: 124997
If you only want a count of the objects that a fetch request would retrieve, call NSManagedObject's -countForFetchRequest:error:
. It's easy enough to tell whether setting includesSubentities
to YES makes a difference -- try it both ways and see. However, if I wanted to be certain that only those objects matching the request were counted, I'd start by setting that property to NO.
Upvotes: 4