We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
我在swift项目里使用dsBridge,用cocoapods集成。然后添加DWebview
var webView = DWebview() override func viewDidLoad() { super.viewDidLoad() self.webView.frame = self.view.bounds self.view.addSubview(self.webView) let jsApi = JsApiHandler() self.webView.javascriptInterfaceObject = jsApi } func loadHTML(_ html: String, baseURL: URL?) { self.webView.loadHTMLString(html, baseURL: baseURL ?? URL(string: "*")!) }
业务需要后端返回的是一个HTML字符串,然后用WebView显示这个页面。
因为该库用OC写的,而原生UIWebView的loadHTMLString方法的baseURL参数是可选参数,DWebView暴露的接口参数没有支持nullable,所以这里就必须填写一个非nil的baseURL,这样要么crash,要么黑屏。
希望接口能支持Swift友好的nullable协议。
补充:单独使用DUIWebView或者DWKWebView使用loadHTMLString方法baseURL为nil运行正常。
The text was updated successfully, but these errors were encountered:
fix bug #24
434388c
fixed! please update version to 2.0.5
Sorry, something went wrong.
fix #24
482399b
No branches or pull requests
我在swift项目里使用dsBridge,用cocoapods集成。然后添加DWebview
业务需要后端返回的是一个HTML字符串,然后用WebView显示这个页面。
因为该库用OC写的,而原生UIWebView的loadHTMLString方法的baseURL参数是可选参数,DWebView暴露的接口参数没有支持nullable,所以这里就必须填写一个非nil的baseURL,这样要么crash,要么黑屏。
希望接口能支持Swift友好的nullable协议。
补充:单独使用DUIWebView或者DWKWebView使用loadHTMLString方法baseURL为nil运行正常。
The text was updated successfully, but these errors were encountered: