記錄工作遇到WKWebView的一個(gè)問(wèn)題:
兩個(gè)視圖控制器:'AViewContrller','BViewContrller'
A有事件:
A -->push or present-->B,
B控制器的View添加了WKWebView的實(shí)例wkWebView,
并且設(shè)置了wkWebView.scrollView.delegate = self,
則當(dāng)B返回A的時(shí)候會(huì)發(fā)生crash.
控制臺(tái)提示:
Cannot form weak reference to instance (0x110c5dc0a) of class BViewContrller.
It is possible that this object was over-released,
or is in the process of deallocation.
在91?編程問(wèn)答找到解決辦法:
在BViewContrller的deinit里設(shè)置
wkWebView.scrollView.delegate = nil