首页 > 代码库 > It is possible that this object was over-released, or is in the process of deallocation解决办法
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解决办法
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。