I have a predicate inside - (NSFetchedResultsController *)fetchedResultsController standard way, starting with the CoreDataBook example.
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"state=%@ && date >= %@ && date < %@", @"1",fromDate,toDate]; [fetchRequest setPredicate:predicate];
This works great, but when editing an item, it returns with NSFetchedResultsChangeDelete not Update. When the main view returns, it lacks an element. If I restart the simulator, the deletion was not saved, and the correct editing result showed that the predicate was working correctly.
case NSFetchedResultsChangeDelete: [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; break;
I can confirm the behavior only by commenting ONLY two lines of predicates, and then everything works as it should return correctly with the full set after editing and calling NSFetchedResultsChangeUpdate instead of NSFetchedResultsChangeDelete.
I read http://matteocaldari.it/2009/11/multiple-contexts-controllers-delegates-and-coredata-bug which reports similar behavior, but I did not find work around my problem.
source share