When I'm attempting to render HTML in a WKWebView using a custom renderer in iOS, the CSS and images aren't rendered when I use;
public void LoadUrl(string url)
{
var uri = new Uri(url);
var safeHostUri = new Uri($"{uri.Scheme}://{uri.Authority}", UriKind.Absolute);
var safeRelativeUri = new Uri($"{uri.PathAndQuery}{uri.Fragment}", UriKind.Relative);
LoadRequest(new NSUrlRequest(new Uri(safeHostUri, safeRelativeUri)));
}
or;
public void LoadUrl(string url)
{
var stringHtml = File.ReadAllText(url, Encoding.UTF8);
var baseUrl = Path.GetDirectoryName(url);
LoadHtmlString(stringHtml, baseUrl == null ? new NSUrl(NSBundle.MainBundle.BundlePath, true) : new NSUrl(baseUrl, true));
}
There is no problem in Android or in iOS emulators. Any help is greatly appreciated!