Multiple inconsistencies in NSFetchedResultsController

Originator:and.mikhaylov
Number:rdar://22684413 Date Originated:14-Sep-2015 05:54 PM
Status:Closed Resolved:
Product:iOS SDK Product Version:9.0 GM
Classification:Serious Bug Reproducible:Always
 
Summary:
NSFetchedResultsController has multiple inconsistencies in iOS 9.0 GM that cause UITableView to crash:

1. FRC sends Update before or after Delete which causes UITableView to crash with the following message:

CoreData: error: Serious application error.  An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:.  attempt to delete and reload the same index path (<NSIndexPath: 0xc000000000000016> {length = 2, path = 0 - 0}) with userInfo (null)

2. Any updates cause FRC to send Insert event first, then Update which results in:

CoreData: error: Serious application error.  An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:.  attempt to insert row 1 into section 0, but there are only 1 rows in section 0 after the update with userInfo (null)

3. Move event is often sent instead of update which is not correct. Both old and new indexes are the same in that case.

Apps built against iOS 9.0 GM SDK using FRC behave differently on iOS 8.4 and iOS 9.0 GM. It’s more stable on iOS 9.0 GM and crash pretty often on iOS 8.4.

Steps to Reproduce:

Expected Results:

Actual Results:

Regression:
iOS 9.0 GM is more stable while iOS 8.4 always almost crash.

Notes:
Here is a workaround I used for Xcode 7 beta 6:
http://stackoverflow.com/a/32466951/351305

Comments

Reply from Apple:

This issue behaves as intended based on the following:

There was a significant bug that was fixed in iOS 9.0. Due to binary compatibility issues, the fix is only active for applications linked on or after iOS 9.0 and we do not plan to backport the fix to iOS 8.

We are now closing this bug report.

If you have questions about the resolution, or if this is still a critical issue for you, then please update your bug report with that information.

Please be sure to regularly check new Apple releases for any updates that might affect this issue.

By and.mikhaylov at Oct. 27, 2015, 11:26 a.m. (reply...)

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!