Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

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.