WKWebView填坑记录20170118

1.WKWebView runJavaScriptAlertPanelWithMessage crash from iOS 9.3

completionHandler must be called even if URL is nil

if let host = self.webkitWebView?.URL?.host {
   ...
}
else {

    webView(_:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:)
    completionHandler()

    //webView(_:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)
    //completionHandler(false)

    //webView(_:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)
    //completionHandler(nil)
}

2.实现网页背景完全透明

self.wkWebView.backgroundColor = [UIColor clearColor];
self.wkWebView.opaque = NO;//背景完全透明

你可能感兴趣的:(WKWebView填坑记录20170118)