i am using WKWebview to show my local htm file. Everything was good, but when i added local picture to my htm files, pictures didn't seem. Lots of stackoverflow user had similar problem but there is no clear answer. here is 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!)
i hope you can help me. i am waiting your answers. thank you.