iOS 17 Public Beta 6 - NSInternalInconsistencyException, UIMenu._resolvedElementSize cannot be called before the menu has been prepared for display

On devices running iOS 17 public beta 6 and our application, there are reports of crash related to NSInternalInconsistencyException, UIMenu._resolvedElementSize cannot be called before the menu has been prepared for display.

Our application uses the WKWebView which loads HTML pages and run JavaScript. The crash seems to happen randomly but usually as a result of interacting with UI elements.

This crash was not seen on iOS 16.6, which is currently the latest public version.

See the following stack trace that was captured by our application :

#1 0x1b309bc00 : objc_exception_throw #2 0x1ba29d808 : <redacted> #3 0x1bd489188 -[UIMenu::_resolvedElementSize] #4 0x1bd48eebc : <redacted> #5 0x1bd48f1dc : <redacted> #6 0x1bdbc4468 -[_UIContextMenuListView::setDisplayedMenu:] #7 0x1bd3111f4 -[_UIContextMenuView::_newListViewWithMenu:position:] #8 0x1bd310108 -[_UIContextMenuView::_displayMenu:inPlaceOfMenu:updateType:alongsideAnimations:] #9 0x1bde9e038 -[_UIContextMenuUIController::presentationTransitionWillBegin] #10 0x1bddc6718 -[_UIContextMenuPresentation::prepareToPresent] #11 0x1bcea0f58 +[UIView::performWithoutAnimation:] #12 0x1bd339f4c -[_UIRapidClickPresentationAssistant::_performPresentationAnimationsFromViewController:] #13 0x1bd339d8c -[_UIRapidClickPresentationAssistant::presentFromSourcePreview:lifecycleCompletion:] #14 0x1bdc06b10 : <redacted> #15 0x1bd121544 : <redacted> #16 0x1bdc06ac0 : <redacted> #17 0x1bdc068e8 -[_UIClickPresentationInteraction::_performPresentation] #18 0x1bdc083f4 : <redacted> #19 0x1bd031e44 : <redacted> #20 0x1bdc0606c -[_UIClickPresentationInteraction::_performPreviewPresentation] #21 0x1be105734 : <redacted> #22 0x1be108a54 : <redacted> #23 0x1be10894c -[UIContextMenuInteraction::_interactionShouldBeginAtPlatformPoint:completion:] #24 0x1be1056f4 -[UIContextMenuInteraction::_presentMenuAtPlatformPoint:]

If you have a sample project, could you submit a new feedback through Feedback Assistant with a sample project that can reproduce this issue, and post the feedback number so that we can take a look?

Hi, unfortunately it is not easy to fully replicate this with a sample application. I've submitted a feedback through the Feedback Assistant (FB13131229) and attached device log etc. If you could take a look and let me know if you still need more information.

i have the similar crash info on ios 17,the IPA is built on XCode 11. The crash info as follows: Trapped uncaught exception 'NSInternalInconsistencyException', reason: 'UIMenu._resolvedElementSize cannot be called before the menu has been prepared for display' ( 0 CoreFoundation 0x00000001ac0945ec CEB74A0C-5EA4-3F5A-9DE8-73F0DAD2F4CB + 972268 1 libobjc.A.dylib 0x00000001a43d7c00 objc_exception_throw + 60 2 Foundation 0x00000001ab600398 FC476CEF-BC79-3C8E-9386-43203DDC2794 + 7062424 3 UIKitCore 0x00000001ae7e4c64 5A61A3B9-1EAB-3524-B091-7EE4AE5AC297 + 6470756 4 UIKitCore 0x00000001ae7ea9b8 5A61A3B9-1EAB-3524-B091-7EE4AE5AC297 + 6494648 5 UIKitCore 0x00000001ae7eacd8 5A61A3B9-1EAB-3524-B091-7EE4AE5AC297 + 6495448 6 UIKitCore 0x00000001aef2761c 5A61A3B9-1EAB-3524-B091-7EE4AE5AC297 + 14083612 7 UIKitCore 0x00000001ae66b2bc 5A61A3B9-1EAB-3524-B091-7EE4AE5AC297 + 4924092 8 UIKitCo<…>

it seems work without crash when building IPA on XCode 13.

Having the same problem with some HTML tags, app completely crashes when clicked, sadly is not possible to re-build the app and put it on the store before creating a mess, Is there any chance to fix this issue at least for certain amount of time on IOS 17?

We have the same issue we have an app built using swift 5 or 5.5, and we use webview. In the new IOS 17, when a user clicks on a <select> html item, the app crashes !!!!

This only happen when the user upgrade his device to ios17 unfortunately, we cannot upgrade the app immediately, it needs more than 3 months, and we cant wait that time!!!

Any fix ?!!!!

iOS 17 Public Beta 6 - NSInternalInconsistencyException, UIMenu._resolvedElementSize cannot be called before the menu has been prepared for display
 
 
Q