Deleting a cell followed by deleting its section from commitEditingStyle crashes with NSInternalInconsistencyException

Originator:elgoog
Number:rdar://34906155 Date Originated:10/10/17
Status:Duplicate/33979092/Open Resolved:No
Product:iOS + SDK Product Version:iOS 11.0.2 15A421
Classification:Bug Reproducible:Always
 
Area:
UIKit

Summary:
In UITableViewController commitEditingStyle:forRowAtIndexPath:, deleting a cell directly followed by deleting its section crashes with an NSInternalInconsistencyException.

Steps to Reproduce:
(Also see sample project.)
1. UITableViewController with 1 section and 1 cell. editingStyleForRowAtIndexPath returns UITableViewCellEditingStyleDelete.
2. In commitEditingStyle:forRowAtIndexPath:, call deleteRowsAtIndexPaths:withRowAnimation:, then call deleteSections:withRowAnimation:
3. Swipe to delete the cell.

Expected Results:
Cell and section disappear. This is the result for iOS 10.3.1 and iOS 9.3.

Actual Results:
Assertion failure in private method, NSInternalInconsistencyException (stacktrace_1.txt).

Also, when using dispatch_async to dispatch the deletion of the section to the main queue, an NSInvalidArgumentException is raised (stacktrace_2.txt).

Version/Build:
iOS 11.0.2 15A421
Also happens in iOS 11.1 15B5078e

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!