问题
在iOS 11以下系统,WKWebView出现
An instance of class WKWebView was deallocated while key value observers were still registered with it.
以上崩溃问题,经发现是没有removeObserver或者delegate没有设置为nil产生
解决方法
在dealloc中:
- (void)dealloc{
//防止iOS11以下奔溃
[self.locationWebView removeObserver:self.progressView forKeyPath:@"estimatedProgress"];
[self.locationWebView setNavigationDelegate:nil];
[self.locationWebView setUIDelegate:nil];
}
网友评论