在iOS和html混编的时候,当用iOS原生的navigation导航pop回去的时候,出现
*** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘An instance 0x155e74a0 of class UIWebView was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x156d3aa0> (
<NSKeyValueObservance 0x156d3a60: Observer: 0x156d12b0, Key path: estimatedProgress, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x15694bd0>
)’
解决方法:
在要pop回去的那个页面加如下代码,remove掉观察者
-(void)dealloc
{
[self.webView removeObserver:self forKeyPath:@”estimatedProgress”];
}
问题得以解决