iOS9 WKWebView 释放时闪退

0.背景描述

项目里发现,在iOS9系统上打开网页后关闭时,应用会闪退,调试得到日志:

2019-12-18 18:25:37.931 xxx[18873:407888] *** -[XXWebViewController retain]: message sent to deallocated instance 0x7ffefd68a740

1.问题查找

依次排查了下页面中使用WKWebView的属性,最后发现只要设置了WKWebView.scrollView.delegate属性,在页面关闭,WKWebView对象释放时就会闪退。

2.解决办法

只需要在controller的dealloc方法中将WKWebView.scrollView.delegate置为nil即可。

猜你喜欢

转载自blog.csdn.net/jhq1990/article/details/103602549
今日推荐