Hello there, we have an iOS application which has been out for quite some time with a custom WKWebView which has been throwing the following exception on the latest iOS 17.4 (Beta)
The application appears to freeze / crash when interacting with input on a WKWebView. Our application also uses react-native, but up until this particular iOS version everything has been working smoothly (since about iOS 12.0 or so).
Here is some more details on the environment
-
iPhone 15 Pro (can reproduce on simulator as well)
-
iOS 17.4 (Beta)
-
Physical device
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=1, subcode=0x1a195a918)
* frame #0: 0x00000001a195a918 WebKit`WTFCrashWithInfo(int, char const*, char const*, int) + 20
frame #1: 0x00000001a25ef8fc WebKit`-[WKContentView(WKInteraction) textInputTraits] + 288
frame #2: 0x00000001c77689c8 PencilKit`+[PKTextInputUtilities textInputTraitsFromTextInput:] + 112
frame #3: 0x00000001c7768be8 PencilKit`+[PKTextInputUtilities isResponderSupportedTextInput:checkForNotes:outTextInputTraits:] + 64
frame #4: 0x00000001c77d5128 PencilKit`+[PKTextInputElementsFinder isResponderEditableTextInput:] + 56
frame #5: 0x00000001c78f29a0 PencilKit`-[PKTextInputWindowFirstResponderController _updateFirstResponder:isVisible:sendDelegateCallback:] + 224
frame #6: 0x00000001c78f2dd8 PencilKit`-[PKTextInputWindowFirstResponderController _textInputResponderDidChangeNotificationHandler:] + 244
frame #7: 0x000000018c7b67a8 CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
frame #8: 0x000000018c7b6170 CoreFoundation`___CFXRegistrationPost_block_invoke + 88
frame #9: 0x000000018c7b60b8 CoreFoundation`_CFXRegistrationPost + 440
frame #10: 0x000000018c7b5608 CoreFoundation`_CFXNotificationPost + 728
frame #11: 0x000000018b65ee10 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 92
frame #12: 0x000000018f63b02c UIKitCore`-[UIKeyboardImpl _postInputResponderChangedNotification] + 224
frame #13: 0x000000018f63c74c UIKitCore`-[UIKeyboardImpl _setDelegate:existingDelegate:force:delayEndInputSession:] + 480
frame #14: 0x000000018ebd4368 UIKitCore`-[UIKeyboardImpl setDelegate:force:delayEndInputSession:] + 664
frame #15: 0x000000018eb931a8 UIKitCore`-[UIKeyboardSceneDelegate _reloadInputViewsForKeyWindowSceneResponder:force:fromBecomeFirstResponder:] + 2916
frame #16: 0x000000018eb92604 UIKitCore`-[UIKeyboardSceneDelegate _reloadInputViewsForResponder:force:fromBecomeFirstResponder:] + 88
frame #17: 0x000000018f860ee4 UIKitCore`-[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 84
frame #18: 0x00000001a25f3cb4 WebKit`-[WKContentView(WKInteraction) _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:] + 1800
frame #19: 0x00000001a1f58024 WebKit`WebKit::PageClientImpl::elementDidFocus(WebKit::FocusedElementInformation const&, bool, bool, WTF::OptionSet<WebCore::ActivityState>, API::Object*) + 108
frame #20: 0x00000001a1f8713c WebKit`WebKit::WebPageProxy::elementDidFocus(WebKit::FocusedElementInformation const&, bool, bool, WTF::OptionSet<WebCore::ActivityState>, WebKit::UserData const&) + 168
frame #21: 0x00000001a252b9d0 WebKit`WebKit::WebPageProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&) + 24380
frame #22: 0x00000001a263f628 WebKit`IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&) + 264
frame #23: 0x00000001a20e9be0 WebKit`WebKit::WebProcessProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&) + 44
frame #24: 0x00000001a263a690 WebKit`IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder>>) + 324
frame #25: 0x00000001a263abb0 WebKit`IPC::Connection::dispatchIncomingMessages() + 708
frame #26: 0x00000001a2887524 JavaScriptCore`WTF::RunLoop::performWork() + 204
frame #27: 0x00000001a288844c JavaScriptCore`WTF::RunLoop::performWork(void*) + 36
frame #28: 0x000000018c7be62c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
frame #29: 0x000000018c7bd8a8 CoreFoundation`__CFRunLoopDoSource0 + 176
frame #30: 0x000000018c7bc0b8 CoreFoundation`__CFRunLoopDoSources0 + 340
frame #31: 0x000000018c7bad88 CoreFoundation`__CFRunLoopRun + 828
frame #32: 0x000000018c7ba968 CoreFoundation`CFRunLoopRunSpecific + 608
frame #33: 0x00000001d0ecf4e0 GraphicsServices`GSEventRunModal + 164
frame #34: 0x000000018ec37350 UIKitCore`-[UIApplication _run] + 888
frame #35: 0x000000018ec3698c UIKitCore`UIApplicationMain + 340
frame #36: 0x0000000100499dec Padlet`main(argc=1, argv=0x000000016f96f708) at main.m:8:14
frame #37: 0x00000001b00fed84 dyld`start + 2240
Stack traces generated with bt
command.
The crash mentions PencilKit but afaik we aren't supporting that here. Any help would be greatly appreciated, many thanks!
The sharedToolPickerForWindow: method is now deprecated, the solution was to change the code to the following:
- (void)setToolPicker API_AVAILABLE(ios(13)) {
self.picker = [[PKToolPicker alloc] init];
[self.picker addObserver:self.canvas];
[self.picker setVisible:true forFirstResponder:self.canvas];
[self.canvas becomeFirstResponder];
}
This was quite difficult to find since it was hidden in an npm package we were using.