0

I need to loop through a fetchedResultsController but having some issues. Here is the code;

for (NSFetchedResultsController *singleResult in _fetchedResultsController) {
    //For logic
}

The warning is;

Collection expression type 'NSFetchedResultsController *' may not respond to 'countByEnumeratingWithState:objects:count:'

What is the correct way to do this?

Matthias Bauch
  • 89,811
  • 20
  • 225
  • 247
Xaphann
  • 3,195
  • 10
  • 42
  • 70

1 Answers1

4

You need to access a member of the _fetchedResultsController that is an iterateable type, such as NSArray or NSSet. For example, NSFetchedResultsController has a property called fetchedObjects that is an NSArray. I suspect this is the array you are looking to access. I am not terribly familiar with the NSFetchedResultsController, but here is a link to the class reference that should help you out the rest of the way

Dan F
  • 17,654
  • 5
  • 72
  • 110