iOS9 WKWebView crashes when released

0. Background description

It is found in the project that when the webpage is opened and closed on the iOS9 system, the application will crash and the log will be obtained after debugging:

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

1. Problem finding

I checked the properties of using WKWebView in the next page in turn, and finally found that as long as the WKWebView.scrollView.delegateproperties are set , when the page is closed, the WKWebView object will crash when it is released.

2. Solution

Just WKWebView.scrollView.delegateset it to nil in the dealloc method of the controller .

Guess you like

Origin blog.csdn.net/jhq1990/article/details/103602549