【发布时间】:2019-10-22 16:23:06
【问题描述】:
我使用 embedio(外部包)开发了一个混合 xamarin ios 移动应用程序。 我在 ios 项目资源下添加了前端资源文件(html 和 javascript 文件)。 然后我们使用资源文件夹中的 embedio 运行静态文件服务器。 Web 视图正在从嵌入式服务器加载内容。
我还从应用程序内部实现了应用程序内更新。 我们正在通过打开应用程序的外部 URL 来更新我们的应用程序。 例如: itms-services://?action=download-manifest;url=https://demo-application/download/1.0.1/plist
然后 ios 开始更新,因为 app bundle id 和 update plist bundle id 相同。
问题是 web 视图 html 内容未更新。
但如果我直接安装最新版本,那么 Web 视图会加载更新的内容。
我已经厌倦了将静态文件服务器的位置从捆绑资源更改为 Environment.SpecialFolder.Personal,并且我在资源文件夹中添加了特定于版本的 html 内容。还尝试通过清除 Web 视图的 cookie。
//嵌入式服务器
var staticFilesWebServer = new WebServer(XamarinConstants.XamarinConstants.FrontEndServerUrl);
staticFilesWebServer.RegisterModule(new StaticFilesModule(location));
staticFilesWebServer.Module<StaticFilesModule>().UseRamCache = true;
staticFilesWebServer.Module<StaticFilesModule>().DefaultExtension = ".html";
staticFilesWebServer.Module<StaticFilesModule>().UseGzip = false;
// main page where i have the web view
WebView.BaseUrl = XamarinConstants.XamarinConstants.FrontEndServerUrl;
WebView.Source = XamarinConstants.XamarinConstants.FrontEndServerUrl + url;
//url for deepli`enter code here`nk
WebView.ContentType = WebViewContentType.Internet;
web 视图应该加载更新后的 html 内容。
【问题讨论】:
标签: c# xamarin xamarin.forms xamarin.ios embedio