WKWebView showing blank on device, working on simulator

前端 未结 1 1426
[愿得一人]
[愿得一人] 2021-01-03 09:34

One of the modules of my app is a web site. That web site contains primarily an SVG drawing, with custom shaped buttons (using Raphael.js library) to access other drawings (

相关标签:
1条回答
  • 2021-01-03 10:18

    i had some problem but i solved problem with configuration options. here is my my code.

        var a = dic["adi"]?.asString()
        var path = NSBundle.mainBundle().pathForResource(a, ofType: "htm" )
        var url = NSURL(fileURLWithPath:path!)
        var request = NSURLRequest(URL:url!)
    
        var theConfiguration = WKWebViewConfiguration()
    
        theWebView = WKWebView(frame:self.view.frame, configuration: theConfiguration)
    
        var error:NSError?
        let text2 = String(contentsOfFile: path!, encoding:NSUTF8StringEncoding, error: &error)
    
        if let theError = error
        {
            print("\(theError.localizedDescription)")
        }
    
        theWebView!.loadHTMLString(text2!, baseURL: nil)
        self.view.addSubview(theWebView!)
    

    hope this helps.

    0 讨论(0)
提交回复
热议问题