NSFetchedResultsController retrieval of NSManagedObject with BOOL property called 'deleted' is inconsistent

Originator:peter.robinett
Number:rdar://15573844 Date Originated:2013-12-03
Status:Open Resolved:
Product:iOS Product Version:7.1 beta
Classification:Other Bug Reproducible:
 
Summary:
The NSFetchedResultsController will return objects which no longer match the filter predicate when an NSManagedObject's property is called 'deleted'. This seems to be because the NSFetchedResultsSectionInfo object from the NSFetchedResultsController will still return a count from numberOfObjects that includes the modified object.

Given that changing the property name to 'removed' leads to everything working as expected, it appears that the user-defined `deleted` property is interfering with private methods with similar names. For instance, the property can be set to YES and retrieved directly as expected, but the managed object's description will show the property as still being NO. However, there are no compiler or run-time warnings about this.

Steps to Reproduce:
1. Have a UITableView which uses an NSFetchedResultsController to get NSManagedObjects to display with the predicated `deleted == NO`
2. Update one of the NSManagedObjects to have deleted = YES
3. The table view will update but still show the 'deleted' object 

Expected Results:
The numberOfObjects count of the NSFetchedResultsSectionInfo from the NSFetchedResultsController will be correct, and the deleted object will no longer be visible.


Actual Results:
The NSFetchedResultsSectionInfo object from the NSFetchedResultsController will still return a count from numberOfObjects that includes the modified object. Therefore, the UITableViewController associated with the NSFetchedResultsController still shows the NSManagedObject which no longer matches the filter predicate and thus should no longer be visible.

The NSFetchedResultsController will return the correct count when first loaded, so reloading the UITableViewController tied to the NSFetchedResultsController will NOT show the 'deleted' object.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!