I'd like to use WKWebView instead of a UIWebView to display data on iOS. However, it seems that loadData:MIMEType:textEncodingName:baseURL: was removed in WKWebView.
Is there any way to mimic this functionality in WKWEbView?
Thanks!
I'd like to use WKWebView instead of a UIWebView to display data on iOS. However, it seems that loadData:MIMEType:textEncodingName:baseURL: was removed in WKWebView.
Is there any way to mimic this functionality in WKWEbView?
Thanks!
You could convert your NSData to NSString and use loadHTMLString:baseURL:
(API Docs).
However, that method has issues with file-system base URLs in the latest beta: WKWebView not working in iOS 8 beta 4.
As of iOS 9.0 and onwards WKWebView
now has the same method:
- loadData:MIMEType:characterEncodingName:baseURL:
That said, I'm currently having issues with certain file types (MS Word) that worked in UIWebView but not in WKWebView.