注释掉该方法,不会崩溃
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
Completion handler passed to -[***ViewController webView:decidePolicyForNavigationAction:decisionHandler:] was not called
(
0 CoreFoundation 0x00007fff20420af6 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff20177e78 objc_exception_throw + 48
2 CoreFoundation 0x00007fff204209d4 -[NSException initWithCoder:] + 0
3 WebKit 0x00007fff286da4b0 _ZN6WebKit28CompletionHandlerCallCheckerD2Ev + 124
4 WebKit 0x00007fff288066a3 _ZN3WTF3RefIN6WebKit28CompletionHandlerCallCheckerENS_13DumbPtrTraitsIS2_EEED2Ev + 41
5 WebKit 0x00007fff2885e048 _ZZN3WTF8BlockPtrIFv24WKNavigationActionPolicyEE12fromCallableIZN6WebKit15NavigationState16NavigationClient31decidePolicyForNavigationActionERNS5_12WebPageProxyEONS_3RefIN3API16NavigationActionENS_13DumbPtrTraitsISC_EEEEONSA_INS5_27WebFramePolicyListenerProxyENSD_ISH_EEEEPNSB_6ObjectEE3$_3EES3_T_ENUlPKvE_8__invokeESQ_ + 60
6 libsystem_blocks.dylib 0x00007fff2007f42f _Block_release + 128
7 WebKit 0x00007fff28859a8e _ZN6WebKit15NavigationState16NavigationClient31decidePolicyForNavigationActionERNS_12WebPageProxyEON3WTF3RefIN3API16NavigationActionENS4_13DumbPtrTraitsIS7_EEEEONS5_INS_27WebFramePolicyListenerProxyENS8_ISC_EEEEPNS6_6ObjectE + 1308
8 WebKit 0x00007fff28901925 _ZN6WebKit12WebPageProxy31decidePolicyForNavigationActionEON3WTF3RefINS_15WebProcessProxyENS1_13DumbPtrTraitsIS3_EEEERNS_13WebFrameProxyEONS_13FrameInfoDataEyONS_20NavigationActionDataESB_NS1_8OptionalINS1_16ObjectIdentifierINS_26WebPageProxyIdentifierTypeEEEEERKN7WebCore15ResourceRequestEOSK_ON3IPC17FormDataReferenceEONSJ_16ResourceResponseERKNS_8UserDataEONS2_INS0_20PolicyDecisionSenderENS4_ISW_EEEE + 4973
9 WebKit 0x00007fff28900568 _ZN6WebKit12WebPageProxy42decidePolicyForNavigationActionAsyncSharedEON3WTF3RefINS_15WebProcessProxyENS1_13DumbPtrTraitsIS3_EEEENS1_16ObjectIdentifierIN7WebCore18PageIdentifierTypeEEENS8_INS9_19FrameIdentifierTypeEEEONS_13FrameInfoDataENS9_21PolicyCheckIdentifierEyONS_20NavigationActionDataESF_NS1_8OptionalINS8_INS_26WebPageProxyIdentifierTypeEEEEERKNS9_15ResourceRequestEOSN_ON3IPC17FormDataReferenceEONS9_16ResourceResponseERKNS_8UserDataEy + 296
10 WebKit 0x00007fff28900406 _ZN6WebKit12WebPageProxy36decidePolicyForNavigationActionAsyncEN3WTF16ObjectIdentifierIN7WebCore19FrameIdentifierTypeEEEONS_13FrameInfoDataENS3_21PolicyCheckIdentifierEyONS_20NavigationActionDataES7_NS1_8OptionalINS2_INS_26WebPageProxyIdentifierTypeEEEEERKNS3_15ResourceRequestEOSF_ON3IPC17FormDataReferenceEONS3_16ResourceResponseERKNS_8UserDataEy + 150
11 WebKit 0x00007fff28bc486a _ZN6WebKit12WebPageProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 9356
12 WebKit 0x00007fff285f0821 _ZN3IPC18MessageReceiverMap15dispatchMessageERNS_10ConnectionERNS_7DecoderE + 125
13 WebKit 0x00007fff28925fc2 _ZN6WebKit15WebProcessProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 28
14 WebKit 0x00007fff285d0eaa _ZN3IPC10Connection15dispatchMessageENSt3__110unique_ptrINS_7DecoderENS1_14default_deleteIS3_EEEE + 696
15 WebKit 0x00007fff285d0773 _ZN3IPC10Connection24dispatchIncomingMessagesEv + 477
16 JavaScriptCore 0x00007fff3221f77d _ZN3WTF7RunLoop11performWorkEv + 573
17 JavaScriptCore 0x00007fff3222028a _ZN3WTF7RunLoop11performWorkEPv + 26
18 CoreFoundation 0x00007fff2038f38a __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
19 CoreFoundation 0x00007fff2038f282 __CFRunLoopDoSource0 + 180
20 CoreFoundation 0x00007fff2038e764 __CFRunLoopDoSources0 + 248
21 CoreFoundation 0x00007fff20388f2f __CFRunLoopRun + 878
22 CoreFoundation 0x00007fff203886d6 CFRunLoopRunSpecific + 567
23 GraphicsServices 0x00007fff2bededb3 GSEventRunModal + 139
24 UIKitCore 0x00007fff24690e0b -[UIApplication _run] + 912
25 UIKitCore 0x00007fff24695cbc UIApplicationMain + 101
26 GovCn 0x0000000108896020 main + 112
27 libdyld.dylib 0x00007fff202593e9 start + 1
)
(lldb)
上述方法中if else,判断不满足,导致的decisionHandler没调用,所以引发该问题