I've got an database scheme like this:
I initialize my fetchcontroller like this:
NSLog(@"%s Only tracked POI query", __PRETTY_FUNCTION__);
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"POI" inManagedObjectContext:context];
[fetchRequest setEntity:entity];
NSPredicate * predicate = [NSPredicate predicateWithFormat:@"rank.tracked == %@",[NSNumber numberWithBool:YES]];
[fetchRequest setPredicate:predicate];
NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
[fetchRequest setSortDescriptors:@[sort]];
[fetchRequest setFetchBatchSize:20];
result = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
managedObjectContext:context sectionNameKeyPath:nil
cacheName:nil];
I've got a Rank entity like you see on the screenshot. When I set the tracked (boolean) to YES this fetchcontroller should show new POI's. Because I retrieve all the POI's which Rank.tracked == YES.
It works but it's always one step behind. I click on a tracked Rank nothing happens, when I click on another Rank to track then the tableview updates with the changes off the previous click.
My tableview is extending https://gist.github.com/CloudNiner/8681866 this stanford class.
Can someone explain me why it's not updating straight away? I found this on SO Changing a managed object property doesn't trigger NSFetchedResultsController to update the table view
But I don't see how it could help me.