*** -[XxxViewController retain]: message sent to deallocated instance xxx

使用如下方式創建WKWebView來加載H5頁面內容:

WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight - KNavHeight)];

webView.UIDelegate = self;

webView.navigationDelegate = self;

webView.scrollView.delegate = self;

在頁面底部有個懸浮分享面板,所以使用了webView.scrollView.delegate = self,通過滾動來顯示或者隱藏分享面板。

H5加載完成后回退頁面,有如下錯誤報出:

*** -[XxxViewController retain]: message sent to deallocated instance xxx。

去掉webView.scrollView.delegate = self問題解決。

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容