bug描述:
An instance 0x10e2a8c00 of class WKWebView was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x17443b3c0> ( <NSKeyValueObservance 0x174654ca0: Observer: 0x10deef750, Key path: title, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x174654cd0> )
原因:
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.mWebView addObserver:self forKeyPath:@"title" options:NSKeyValueObservingOptionNew context:NULL];
}
解决方案:
在dealloc中添加释放代码
-(void)dealloc{
[self.mWebView removeObserver:self forKeyPath:@"title"];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}