Core Data NSFetchedResultsController - Total number of records returned

Neal L picture Neal L · Jan 22, 2010 · Viewed 18.7k times · Source

I'm using an NSFetchedResultsController in an iPhone app, and am wondering if there is some easy way of getting the total number of rows returned in all sections.

Instead of getting the [[fetchedResultsController sections] count] and then looping through each section to get its count, can it be done in one line?

Thanks!

Answer

gerry3 picture gerry3 · Jan 22, 2010

This line returns the total number of fetched objects:

[fetchedResultsController.fetchedObjects count]