美文网首页
WKWebView报错 WKWebView was deall

WKWebView报错 WKWebView was deall

作者: guoshengboy | 来源:发表于2018-05-17 14:31 被阅读0次

    今天遇到了第一次点击web浏览器没问题 ,第二次就崩溃
    报错:WKWebView was deallocated while key value observers were still registered with it

    因为控制器dealloc之前没有移除kvo
    [self.webView addObserver:self
    forKeyPath:@"title"
    options:NSKeyValueObservingOptionNew
    context:nil];

    解决办法:
    -(void)dealloc{
    [_webView removeObserver:self forKeyPath:@"title"];
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    }

    相关文章

      网友评论

          本文标题:WKWebView报错 WKWebView was deall

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