【发布时间】:2016-09-20 22:39:17
【问题描述】:
我正在尝试在 WKWebView 中加载一些数据,编译器不会让我为 baseUrl 参数传入 nil 或 URL()。有解决方法吗?我根本不在乎 baseUrl。
下面是我的代码,分别尝试nil 和URL() 以及错误。
self.webView.load(data!, mimeType: "image/png", characterEncodingName: "UTF-8", baseURL: nil);
error: nil is not compatible with expected argument type 'URL'
self.webView.load(data!, mimeType: "image/png", characterEncodingName: "UTF-8", baseURL: URL());
error: cannot invoke initializer for type 'URL' with no arguments
【问题讨论】:
-
stackoverflow.com/questions/32761819/… 的可能重复项(语法适用于 Swift 2,但问题相同)
标签: ios swift swift3 wkwebview