I’m executing an NSFetchRequest with a NSFetchedResultsController. I set a fetchBatchSize of 5, and implement the proper delegate methods:
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath
- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type
- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller
And I make sure to set the delegate of my fetchedResultsController to self. However, I put a NSLog statement in all the above delegate methods, and none of them are getting called. My fetchRequestController fetch count is 204, and the batch size is 5, so isn’t it supposed to be calling some of the delegate methods as I scroll down the table? Or what’s another way to make sure it’s working?
You should be able to use fast enumeration on the fetchedObjects array of the fetchedResultsController and test the
isFaultproperty of each NSManagedObject. If you only asked for it to return 5, I think you should see that 5 have isFault set to NO and the rest have isFault set to YES.See the NSManagedObject Class Reference for info on the isFault property.