It is possible that this object was over-released, or is in the process of deallocation解决办法

Posted 纠结的哈士奇

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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里写,一样的。

 

以上是关于It is possible that this object was over-released, or is in the process of deallocation解决办法的主要内容,如果未能解决你的问题,请参考以下文章