Core Data table record count

Posted by user339633 on Stack Overflow See other posts from Stack Overflow or by user339633
Published on 2010-05-12T18:59:44Z Indexed on 2010/05/12 19:04 UTC
Read the original article Hit count: 282

Filed under:
|
|
|
|

I have an entity called Person and it has a relationship called participatingGames, to another entity called GameParticipant.

I (apparently) can retrieve the number of matches in the GameParticipant entity using this simple code in the Person object I created from the entity in the model:

[self.participatingGames count];

However, I'd just like to retrieve the number of Person records and one might guess the syntax for this is just as simple.

I have lots of books including those by Jeff LaMarche, but those sources and what I find around here make me wonder if I need to set up a fetchedResultsController just to know the count of some entity.

My background is in SQL, so of course it seems odd that what would take 15 seconds to code in any other environment seems like such a well-guarded secret in Core Data.

I'm using iPhone SDK 3.1.4 under OSX 10.5.8

Suggestions?

© Stack Overflow or respective owner

Related posts about core

Related posts about data