webview使用遇到 It is possible that this object was over-released, or is in the process of deallocation错误的解决办法


使用wekwebview时,push后,再pop返回,报错了:

Cannot form weak reference to instance (xxxx) of class xxxx. It is possible that this object was over-released, or is in the process of deallocation.

 

 


解决方案:

1. 不要在 dealloc 方法中,使用 weak self

2. A控制器(包含scrollView及其子类,并设置了其代理),B控制器(webView,并设置了webView.scrollView.delegate = self),当A push 到 B,然后B pop回 A时,会引起程序崩溃。解决方案就是再B将要退出时把webView.scrollView.delegate = nil

 

我用第二种办法解决了,在deinit添加如下

deinit{
    wkWebView.scrollView.delegate = nil

}

如果是oc,就在deallco里写,一样的。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM