You can modify the NSFetchRequest
of an NSFetchedResultsController
without problems. There is a special section in the documentation about this topic. If you use a cache, you need to delete it, afterwards you can change your fetch request and call performFetch:
again, on your NSFetchedResultsController
. The trick is to modify the existing NSFetchRequest
on your controller instead of trying to set a new fetch request, which will not work.
In your case, you might want to set the predicate of the fetch request by calling -[NSFetchRequest setPredicate:]
[NSFetchedResultsController deleteCacheWithName:cacheName];
[self.controller.fetchRequest setPredicate:[NSPredicate predicateWithFormat:@"status == %@", currentStatus]];
NSError* error = nil;
if (![self.controller performFetch:&error]) {
NSLog(@"Error updating fetch: %@", error);
}
This should do what you want.