iOS:WebKitLegacy崩溃

前端之家收集整理的这篇文章主要介绍了iOS:WebKitLegacy崩溃前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在一些相对安全(对我来说)修改后,应用程序开始崩溃一些WebKitLegacy的东西.我在Fabric中看到很多崩溃,但找不到稳定的重现步骤.
有谁知道什么会导致这些崩溃?请参阅附图.

一些应用程序屏幕使用UIWebView显示内容 – 我认为问题出在那里.


解决方法

UIWebView EXC_BAD_Address …应用程序接收到的信号
首先,您应该考虑webView.delegate = nil.
但是哪里 ??

我的经验:

- (void)dealloc{
    /*
     Important
     Before releasing an instance of UIWebView for which you have set a delegate,you must first set the UIWebView delegate property to nil before disposing of the UIWebView instance. 
     This can be done,for example,in the dealloc method where you dispose of the UIWebView.
     */
    if (_webView.loading) {
        [self.webView stopLoading];
    }
    _webView.delegate = nil;
}

if the ViewController is a child of a another ViewController,you can
trigger the removal of the ViewController‘s view from the parent
ViewController‘s view with an animation. At the same time,you can
remove the ViewController from its parent and nil out its reference.
at this point ViewController will be nil and viewWillDisappear will
never be called
,meaning **the WebView delegate will never be cleaned up
**
Use dealloc and ensure that your WebView is always cleaned up.

其他优秀的链接
ios:EXC_BAD_ACCESS for Webview delegate

原文链接:https://www.f2er.com/iOS/331344.html

猜你在找的iOS相关文章