0

In my app,push to a view controller contains wkwebview and use long press gesture to show the select text menu,then pop the view controller make web view to dealloc.And then push to another web view controller,send a gesture to webview,then crashed.It's occurd on iOS 14 beta 2.I have report the bug to apple.It's exist some way workround?

Date/Time:             2020-07-13 18:46:00.715 +0800
OS Version:            Mac OS X 10.15.5 (19F101)
Report Version:        12
Bridge OS Version:     4.5 (17P5300)
Anonymous UUID:        DC589A65-FAD9-1105-69E1-F841F6FEE2E3

Sleep/Wake UUID:       D3E2CB0D-6218-4CC0-85C5-86C8DAE0B4BC

Time Awake Since Boot: 240000 seconds
Time Since Wake:       33000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000022
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [50050]

VM Regions Near 0x22:
--> 
    __TEXT                 000000010f792000-000000010f796000 [   16K] r-x/r-x SM=COW  /Users/USER/Library/Developer/CoreSimulator/Devices/4CDD359F-0A7E-4E13-A2CE-0DA825D90269/data/Containers/Bundle/Application/D19A53D4-CA61-4FCA-9F2D-ECAEA1A0D9C3/TestWebView.app/TestWebView

Application Specific Information:
CoreSimulator 725.10 - Device: iPhone 8 (4CDD359F-0A7E-4E13-A2CE-0DA825D90269) - Runtime: iOS 14.0 (18A5319g) - DeviceType: iPhone 8

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                 0x0000000110d38b88 objc_retain + 8
1   com.apple.UIKitCore             0x00000001219ec716 -[UIInputResponderController prepareToMoveKeyboardForInputViewSet:animationStyle:] + 348
2   com.apple.UIKitCore             0x00000001219eacdf -[UIInputResponderController setKeyWindowSceneInputViews:animationStyle:] + 623
3   com.apple.UIKitCore             0x00000001219eaa45 -[UIInputResponderController setInputViews:animationStyle:] + 200
4   com.apple.UIKitCore             0x00000001219ec000 -[UIInputResponderController setInputViews:animated:] + 88
5   com.apple.UIKitCore             0x00000001219ec067 -[UIInputResponderController setInputViews:] + 68
6   com.apple.UIKitCore             0x00000001219e98a9 __74-[UIInputResponderController _reloadInputViewsForKeyWindowSceneResponder:]_block_invoke.605 + 30
7   com.apple.UIKitCore             0x00000001219e94b2 -[UIInputResponderController _reloadInputViewsForKeyWindowSceneResponder:] + 3982
8   com.apple.UIKitCore             0x00000001219e8507 -[UIInputResponderController _reloadInputViewsForResponder:] + 148
9   com.apple.UIKitCore             0x0000000121fdb741 -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 133
10  com.apple.UIKitCore             0x0000000121fd6af9 -[UIResponder becomeFirstResponder] + 806
11  com.apple.UIKitCore             0x00000001224df189 -[UIView(Hierarchy) becomeFirstResponder] + 145
12  com.apple.WebKit                0x000000010fed7f9c -[WKContentView(WKInteraction) becomeFirstResponderForWebView] + 136
13  com.apple.WebKit                0x000000010fac30c8 -[WKWebView(WKViewInternalIOS) becomeFirstResponder] + 133
14  com.apple.UIKitCore             0x00000001222870b7 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) setFirstResponderIfNecessaryActivatingSelection:] + 195
15  com.apple.UIKitCore             0x00000001222881e7 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) checkEditabilityAndSetFirstResponderIfNecessary] + 376
16  com.apple.UIKitCore             0x0000000122257e63 -[UITextIndirectNonEditableInteraction willBeginGesture] + 128
17  com.apple.UIKitCore             0x0000000121e16573 -[_UIKeyboardBasedNonEditableTextSelectionInteraction oneFingerForcePan:] + 1339
18  com.apple.UIKitCore             0x0000000121aed683 -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 49
19  com.apple.UIKitCore             0x0000000121af7904 _UIGestureRecognizerSendTargetActions + 100
20  com.apple.UIKitCore             0x0000000121af41cb _UIGestureRecognizerSendActions + 294
21  com.apple.UIKitCore             0x0000000121af352a -[UIGestureRecognizer _updateGestureForActiveEvents] + 725
22  com.apple.UIKitCore             0x0000000121ae5a72 _UIGestureEnvironmentUpdate + 2652
23  com.apple.CoreFoundation        0x0000000110dfc277 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
24  com.apple.CoreFoundation        0x0000000110df6dae __CFRunLoopDoObservers + 487
25  com.apple.CoreFoundation        0x0000000110df72df __CFRunLoopRun + 1137
26  com.apple.CoreFoundation        0x0000000110df6aba CFRunLoopRunSpecific + 538
27  com.apple.GraphicsServices      0x00000001139fcdb3 GSEventRunModal + 139
28  com.apple.UIKitCore             0x0000000121fa27fe -[UIApplication _run] + 912
29  com.apple.UIKitCore             0x0000000121fa7e1e UIApplicationMain + 1570
30  jkl.TestWebView                 0x000000010f793fa2 main + 114 (main.m:17)
31  libdyld.dylib                   0x0000000119d4395d start + 1

Thread 1:


apricot
  • 434
  • 1
  • 4
  • 10

1 Answers1

0

I met the same problem.

It seems -[UIInputViewSet restorableResponder] returns a wild pointer. This property is neither weak nor strong. I added a symbol breakpoint to -[UIInputViewSet restorableResponder] and -[UIInputViewSet setRestorableResponder:], the assembly code shows they have neither store_weak nor store_strong code.

I used a workaround, hook -[UIInputViewSet restorableResponder] and return nil. Maybe it will cause another problem. But after testing it seems work well.