通过Javascript下载Apple托管的按需标记资源 [英] Download Apple hosted on-demand tagged resources via Javascript
问题描述
I'm digging around Apple documentation about on-demand resources but I can't find this information..
是否可以通过Java脚本从WKWebView提取按需资源(例如图像,Java脚本束)?
Is it possible to fetch On-Demand Resources (eg. image, Javascript bundle) from a WKWebView via Javascript?
我的目的是在Apple服务器上发布一些(大型)HTML + JS游戏作为按需标记的资源,然后通过Javascript XHR调用或通过Cordova/Phonegap/Ionic插件获取它们.
My intent is to publish some (big) HTML+JS games on Apple servers as On-Demand tagged Resources and then fetch them via Javascript XHR calls or through a Cordova/Phonegap/Ionic plugin.
通过这种方式:
-
我们不会影响App最终捆绑包的大小,包括所有游戏
We would not affect the App final bundle size including all the games
Apple可以查看游戏(因为它不是外部的注入代码",这违反了他们的指南).
Apple would be able to review the games (since it's not externally "injected code" - that is against their guidelines).
在我的特定情况下,我将使用Cordova插件 cordova-plugin-filetransfer 下载标记的按需资源和 cordova -plugin-file 以将下载的游戏加载并显示到网络视图中.
In my specific case, I would use the Cordova plugin cordova-plugin-filetransfer to download the tagged on-demand resources and cordova-plugin-file to load and display the downloaded game into the webview.
由于业务限制,这是我们需要实现的目标.可行吗?
This is what we need to achieve due to business constraints. Is it feasible?
推荐答案
- 使用仅采用Cordova的解决方案(使用 cordova-插件文件).
- Apple仅允许您使用其本机API访问那些按需资源,而它们尚未通过外部API公开这些资源.
因此,为了在Cordova应用程序中加载ODR,我们需要创建一个自定义插件,该插件调用用于处理按需资源的Native API(请参阅
So, in order to load ODRs in a Cordova App, we would need to create a custom plugin that calls the Native API that takes care of loading the On-Demand Resources (see NSBundleResourceRequest).
在Reddit Flutter社区中找到答复:
Reply found in the Reddit Flutter community:
https://www.reddit.com/r/FlutterDev/评论/ejmf3a/apples_odr_network_via_flutter/
这篇关于通过Javascript下载Apple托管的按需标记资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!