我正在快速制作WKWebView
,但遇到了问题。我可以在chrome浏览器或safari中看到网络警报,但在webview中看不到。我上传了2张图片。有谁可以帮忙吗?
var webView: WKWebView!
var popupWebView: WKWebView?
override func viewDidLoad() {
super.viewDidLoad()
setupWebView()
let myURL = URL(string:"http://*******/LiveGallery/")
let myRequest = URLRequest(url: myURL!)
webView.load(myRequest)
}
func setupWebView() {
let preferences = WKPreferences()
preferences.javaScriptEnabled = true
preferences.javaScriptCanOpenWindowsAutomatically = true
let configuration = WKWebViewConfiguration()
configuration.preferences = preferences
webView = WKWebView(frame: view.bounds, configuration: configuration)
webView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(webView)
}
}