ios webview pop崩溃

时间:2017-08-22 04:48:51

标签: ios uiwebview

任何人都知道当webview弹出时崩溃是什么,它会在某个时候发生。

0 libobjc.A.dylib 0x0000000190c8ef30 objc_msgSend  (respondsToSelector:) + 16
1 CoreFoundation 0x0000000192248078 ____forwarding___ + 404
2 CoreFoundation 0x000000019214259c _CF_forwarding_prep_0 + 80
3 CoreFoundation 0x000000019224a160 ___invoking___ + 144
4 CoreFoundation 0x000000019213dc3c -[NSInvocation invoke] + 284
5 WebCore 0x0000000196cea200 HandleDelegateSource(void*) + 108
6 CoreFoundation 0x00000001921f2278 ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
7 CoreFoundation 0x00000001921f1bc0 ___CFRunLoopDoSources0 + 524
8 CoreFoundation 0x00000001921ef7c0 ___CFRunLoopRun + 804
9 CoreFoundation 0x000000019211e048 CFRunLoopRunSpecific + 436
10 GraphicsServices 0x0000000193ba1198 GSEventRunModal + 172
11 UIKit 0x00000001980f8628 -[UIApplication _run] + 684
12 UIKit 0x00000001980f3360 UIApplicationMain + 208
13 HuaYang 0x00000001007dc894 main (main.m:21)
14 libdyld.dylib 0x00000001911005b8 _dyld_process_info_notify_release + 36

1 个答案:

答案 0 :(得分:6)

  

objc_msgSend(respondsToSelector:) - 这是一个内存管理问题。你需要在僵尸打开的情况下复制崩溃的条件,然后检查一次其他选项停止加载webView并在离开视图之前删除委托:

目标C

- (void)viewWillDisappear:(BOOL)animated{
    [yourwebViewname setDelegate:nil];
    [yourwebViewname stopLoading];
}

<强>迅速

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
yourwebViewname.delegate = nil
yourwebViewname.stopLoading()
}