码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-02-28 15:28:20      阅读:3224      评论:0      收藏:0      [点我收藏+]

标签:方案   weak   解决办法   object   解决   init   possible   ati   lease   

使用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解决办法

标签:方案   weak   解决办法   object   解决   init   possible   ati   lease   

原文地址:http://www.cnblogs.com/yajunLi/p/6478868.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!