App crashes when "brushing" a table view cell with swipe actions ('No occurrence for index path (null)')

Originator:tim.viaene
Number:rdar://42848466 Date Originated:02-Aug-2018 11:24 AM
Status:Open Resolved:
Product:iOS + SDK Product Version:iOS 11 and up
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
This is the most common crash users of our app experience.
Once I was able to reproduce it in our app I made a minimal sample project that exposes the issue.

The trick is to quickly “brush” a table view cell with your finger. If the cell has swipe actions (swipe-to-delete being the most common example of this) there’s a good that this will happen:

    Fatal Exception: NSInternalInconsistencyException
    No occurrence for index path (null)

    *** Assertion failure in -[UISwipeActionController swipeHandlerDidBeginSwipe:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3698.54.4/SwipeActions/UISwipeActionController.m:268
    *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'No occurrence for index path (null)'

I was able to reproduce this with the older `tableView:titleForDeleteConfirmationButtonForRowAtIndexPath:`/`tableView:commitEditingStyle:forRowAtIndexPath:` API as well as the newer `tableView:trailingSwipeActionsConfigurationForRowAtIndexPath:` API in iOS 11.

* I could not reproduce this crash in iOS 10.
* I could reproduce this crash in the iOS 12 beta.
* I have only been able to trigger this crash on an actual iPad (not in the simulator, not on iPhone) so far.

Steps to Reproduce:
1. Run the attached “crashme” Xcode project on an actual iPad
2. Quickly “brush” the table view cell. Most likely it will take multiple tries to trigger the crash

Expected Results:
Either nothing should happen (it’s a very light touch), or the cell should reveal its Delete button

Actual Results:
The app crashes:


    *** Assertion failure in -[UISwipeActionController swipeHandlerDidBeginSwipe:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3698.54.4/SwipeActions/UISwipeActionController.m:268
    *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'No occurrence for index path (null)'

Version:
iOS 11 and up

Notes:
Attachments:
* crash-reports.zip: contains App Store crash reports exported from Xcode.
* crashme.zip: contains a sample project demonstrating the bug
* crashme.MOV: video showing how to reproduce the crash with the sample project

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!