1.錯(cuò)誤描述:
An instance 0x11642da00 of class WKWebView was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x1708316e0> ( <NSKeyValueObservance 0x170648b50: Observer: 0x117910cc0, Key path: title, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x170643c90>
2.原因:因?yàn)闆]有移除WKWebView的監(jiān)聽方法
//添加獲取web頁(yè)面title的監(jiān)聽
[self.webView addObserver:self forKeyPath:@"title" options:NSKeyValueObservingOptionNew context:NULL];
3.移除KVO監(jiān)聽方法
-(void)dealloc{
? ? [self.webView removeObserver:self forKeyPath:@"title"];
? ? NSLog(@"WebViewController-dealloc");
}