I want to refetch data from my NSFetchedResultsController using a different predicate which is set using a boolean value. How do I refresh NSFetchedResultsController to fetc
I had similar problem, I couldn't figure out why my collection view doesn't refresh its cells. Adding the method below fixed my problems.
-(void)didUpdateObjectAtIndexPath:(NSIndexPath *)indexPath{
UICollectionView *strongCollectionView = self.collectionView;
[strongCollectionView reloadItemsAtIndexPaths:@[indexPath]];
}
Don't forget to set fetchedResultsController = nil before performFetch. Otherwise it will use the old one.
Here's how we do it in an application:
// Assuming these exist
NSPredicate * predicate;
NSString * cacheName;
[[fetchedResultsController fetchRequest] setPredicate:predicate];
[NSFetchedResultsController deleteCacheWithName:cacheName];
NSError * error = nil;
[fetchedResultsController performFetch:&error];
if (error) {
// report error
}