我正在尝试使用LoadFileUrl方法在WKWebView中加载本地html文件,但是我得到的是一个空白视图。这是一个Xamarin.Mac应用程序(尚未有沙盒)。
WKWebViewConfiguration conf = new WKWebViewConfiguration();
WKWebView www = new WKWebView (View.Frame, conf);
View = www;
string index = Path.Combine (NSBundle.MainBundle.BundlePath, "WebApp/Index.html");
string webAppFolder = Path.Combine (NSBundle.MainBundle.BundlePath, "WebApp");
www.LoadFileUrl (new NSUrl ("file://"+index), new NSUrl ("file://"+webAppFolder));
"LoadRequest"可以很好地从远程服务器加载网页。
"Index.html"文件的构建操作为"BundleResource"。
感谢您的所有帮助!