Crash when choosing Share action in WKWebview long press menu from presented view controller on iOS 11

Number:rdar://34933660 Date Originated:10/11/2017
Status:Open Resolved:No
Product:iOS SDK + WebKit Product Version:iOS 11
Classification:Bug Reproducible:Always


WKWebview does not correctly dismiss its long-press action sheets (e.g. link actions, image actions) on iOS 11+ when the web view is contained in a modally presented view controller. Immediately following the action sheet dismissal, the modally presented view controller containing the web view is also dismissed.

Choosing "Share..." from the web view's long-press action sheet causes another sheet to be presented, but the app will crash when this second sheet is dismissed. As far as I can tell this is because WebKit internally keeps a reference to the original modally presented view controller which is no longer valid since the controller was dismissed along with the first action sheet.

Steps to Reproduce:

1. Present view controller modally containing a WKWebView
2. Navigate WKWebview to any page with a tappable link
3. Long-press any link in the web view
4. Tap "Share..." in the action sheet
5. Tap "Cancel" in the share sheet

Expected Results:

Share sheet is dismissed normally and modally presented view controller hierarchy (including web view) remains presented.

Actual Results:

Modally presented view controller hierarchy is dismissed when choosing "Share" and the app crashes after the share sheet is dismissed.


All versions of iOS 11.0+ including 11.1 beta 2


Any iPhone model (untested on iPad)


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at 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!