Load content from app bundle with WKWebView.LoadFileUrl

I have a problem similar to this one:
This is the code:

string localHtmlPath = System.IO.Path.Combine(NSBundle.MainBundle.ResourcePath, "file.html");
if (System.IO.File.Exists(localHtmlPath))
    SourceCodeView.LoadFileUrl(new NSUrl("file://" + localHtmlPath), new NSUrl("file://" + localHtmlPath));

The file.html has BundleResource build action, File.Exists returns true and still the WKWebView remains empty.
If localHtmlPath is set to a path outside the app bundle (/Users/myuser/file.html for example), the WKWebView loads the html file without problems.
Is there a setting that prevents the WKWebView to load html files from app bundle?


Best Answer


Sign In or Register to comment.