在一些相对安全(对我来说)修改后,应用程序开始崩溃一些WebKitLegacy的东西.我在Fabric中看到很多崩溃,但找不到稳定的重现步骤.
有谁知道什么会导致这些崩溃?请参阅附图.
有谁知道什么会导致这些崩溃?请参阅附图.
解决方法
UIWebView EXC_BAD_Address …应用程序接收到的信号
首先,您应该考虑webView.delegate = nil.
但是哪里 ??
首先,您应该考虑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 anotherViewController
,you can
trigger the removal of theViewController
‘s view from the parent
ViewController
‘s view with an animation. At the same time,you can
remove theViewController
from its parent and nil out its reference.
at this pointViewController
will be nil andviewWillDisappear
will
never be called,meaning **the WebView delegate will never be cleaned up
**
Use dealloc and ensure that yourWebView
is always cleaned up.