2

Trying to use ios on-demand resources in a cordova project and need to add a folder to the ios project that I can mark as belonging to a target then add an on-demand resource tag.

I can do this in the generated xcode project by using 'add files' and adding the folder. Then in the File Inspector, check the required target then in the 'On Demand Resource Tags' text box adding my tag e.g. 'MY_TAG'.

Obviously it isn't feasible to generate the project by doing a cordova build then manually adding and tagging the folder but I can't figure out how to add the folder and tag it using various plugins, hooks etc. I tried moving the folder into the root of the ios project using a custom hook (after_prepare) and the folder is in the resulting xcode project but I still have to manually add it and tag it.

It seems that cordova is not happy about me adding folders at the same level as the www directory. I need a directory structure :

myproject
    www
    MyOnDemandResourcesFolder

If I do add the folder under the www folder (as a sub folder) the option to associate it with a target and provide an on-demand resource tag is not available in the file inspector of the xcode project. In fact, that goes for any sub folder that you create in the xcode project - it cannot be marked as an On-Demand Resource.

Any help would be much appreciated. It doesn't seem that many people are using on-demand resources apart from simple use cases of individual files.

alxlives
  • 5,084
  • 4
  • 28
  • 50
Liam James
  • 21
  • 1
  • 1
    Did you manage to find a solutions for this? – dogwasstar Mar 26 '20 at 05:59
  • We did find a solution although it was extremely unpleasant! We've had to do numerous hacks in our build process. I'm reluctant to post since its a very convoluted path. – Liam James Apr 03 '20 at 12:04

1 Answers1

1

On Demand Resources are not supported at the moment by Cordova. Recently there was a PR submitted to cordova-node-xcode repository, that would be the step 1 for adding support, but a lot of work still pending.

https://github.com/apache/cordova-node-xcode/pull/87

jcesarmobile
  • 51,328
  • 11
  • 132
  • 176
  • but even using that tool to tag ODR resources, then there is no plugin to then load them through Cordova. Related SO with 100 bounty: https://stackoverflow.com/questions/60955952/download-apple-hosted-on-demand-tagged-resources-via-javascript – Gabe Apr 02 '20 at 14:20
  • 1
    yeah, as I said, it's not supported, that's just the first step of many and it's not even merged yet – jcesarmobile Apr 02 '20 at 14:28
  • I used this PR too and successfully integrated ODR in my App. (I had to write a simple custom plugin to download the ODR from Apple servers). – Gabe Jun 06 '20 at 04:51