Apple “on-demand resources” plugin now available

Apple “on-demand resources” plugin now available

Corona Labs is pleased to announce the availability of the on-demand resources plugin, currently supported on tvOS. Similar in concept to Android expansion files (but functionally quite different), on-demand resources allow you to specify parts/assets of your app which can be downloaded when needed. This is especially important for Apple TV because Apple limits tvOS apps to a maximum size of 200 megabytes and they provide no local storage for data. Instead, they expect developers to use on-demand resources to manage which assets are available at which points in the app.


Like any plugin, begin by including it in your build.settings:

Defining resources

To make on-demand resources work, you must designate various files or folders by “tags” inside the tvosonDemandResources table of build.settings. Each entry is itself a table containing two required key-value pairs: the tag name (tag) and the file/folder it refers to (resource):

In addition, you can specify a download priority for each tag. This is done via the type key with one of the following values:

  • "install" — Use this for critical files that may be required immediately when the app first launches. These resources download in parallel with the app download itself, however they are not bundled in the app package as persistent resources.
  • "prefetch" — These resources will start downloading in the background after the app finishes downloading.
  • No type — These are resources you fetch when you need them.

Regardless of the type value, you need to explicitly request the tag before you can use it. Tags that don’t have a type are requested at a logical point during the app flow.

Requesting content

To download a resource file/folder when needed, for example assets for the second level after the player completes the first level, simply call the onDemandResources.request() function. This may be considered the “core” function of the plugin, as it’s required before you can access on-demand resources.

One of the most important aspects of onDemandResources.request() is the second parameter: a boolean true or false. Setting this to true (or omitting it, since true is the default) tells Corona to begin downloading the resources immediately.

By comparison, if you set this parameter to false, Corona simply checks if the resources are already downloaded:

Important notes

  • All on-demand resources are subject to be evicted by the operating system if it needs space, so even your install– and prefetch-based resources should be checked for availability before you attempt to use them. If they don’t exist, you will need to request/download them again.
    • Large downloads take time, so you may consider more tags with smaller overall download sizes. Apple advises keeping tagged resources under 64 megabytes. The maximum size for a tag is 512 megabytes.
  • You have to use a service like Apple’s TestFlight to test on-demand resources — you cannot simply load the app directly onto your test device. This is the only way Apple can actually deliver the various resources from their servers.


On-demand resources can be essential for developing tvOS games and apps, and Corona’s plugin provides the necessary interface to Apple’s servers. To learn more, please see the documentation or discuss further in the Corona Forums.

Rob Miracle

Rob is the Developer Relations Manager for Corona Labs. Besides being passionate about helping other developers make great games using Corona, he is also enjoys making games in his spare time. Rob has been coding games since 1979 from personal computers to mainframes. He has over 16 years professional experience in the gaming industry.

  • Scott
    Posted at 11:13h, 23 March

    No iOS support?

    • Rob Miracle
      Posted at 15:14h, 23 March

      No iOS support.

  • Anders Hjarnaa
    Posted at 17:57h, 23 March

    This is great news, I have really been looking forward for this. When will it be available for iOS, and not just tvOS?

  • Ed Maurina
    Posted at 09:31h, 24 March

    Sweet. I’m very pleased with the number of important updates and additions we’re seeing to Corona this year. Kudos to the whole team.