美文网首页
iOS WKWebview的iOS 11以下崩溃问题

iOS WKWebview的iOS 11以下崩溃问题

作者: freesan44 | 来源:发表于2020-04-26 16:53 被阅读0次

    问题

    在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];
    }
    

    相关文章

      网友评论

          本文标题:iOS WKWebview的iOS 11以下崩溃问题

          本文链接:https://www.haomeiwen.com/subject/kzrjwhtx.html