Contents

Background Assets

Improve or eliminate the time people wait while your app downloads assets.

Overview

Let the system manage your asset downloads on people’s devices for you according to your preferences, and optionally, host your assets on Apple servers. For example, a game might specify that the system downloads tutorial assets before first launch and other assets on demand — such as level packs, 3D character models, and textures — as a player progresses during gameplay. The default implementation of Managed Background Assets handles downloads, updates, compression, and more for you. If you choose Apple-Hosted Background Assets, you upload your assets to App Store Connect and maintain them there, similar to app builds.

[Image]

To use these features:

  1. Group your assets into asset packs containing manifest files that specify a download policy and other details. You can specify that the system downloads essential asset packs before launch, prefetches others without blocking launch, and downloads some only on demand when you need them. For more information, see Creating managed asset packs.

  2. Add a managed Background Download extension to your project and configure your project accordingly. Optionally, customize your downloader extension and add code to your app that downloads on-demand assets when needed. For more information, see Downloading Apple-hosted asset packs.

  3. For either Apple-hosted or self-hosted asset packs, before you distribute your app, test your code using a local mock server included in your Xcode install. For more information, see Testing asset packs locally.

  4. For Apple-hosted assets, upload your asset packs to App Store Connect before you distribute your app through TestFlight or the App Store. For more information, see the Overview of Apple-hosted asset packs in App Store Connect Help.

Alternatively, you can manage and host asset downloads yourself using the low-level Background Assets APIs. For more information, see Configuring an unmanaged Background Assets project and Downloading essential assets in the background.

Migrate from On-Demand Resources

If your app uses the deprecated On-Demand Resources system, you can migrate to Background Assets. Background Assets offers several advantages over On-Demand Resources:

  • Background Assets allows you to update assets without having to submit a new app build.

  • You can host your assets on your own servers or use Apple-hosted assets.

  • Managed Background Assets automatically manages asset downloads, updates, compression, and more.

To migrate an app that uses On-Demand Resources to Background Assets, do the following:

  • In Xcode, set the “Enable On-Demand Resources” build setting to “No” at the project level and in any target where you overrode the project-level setting.

  • Remove any On-Demand Resources tags you added in your Xcode project.

  • Update your code to remove any mention of NSBundleResourceRequest.

Then adopt the Background Assets framework to replace your uses of On-Demand Resources.

Topics

Essentials

Managed asset packs

Apple-hosted managed asset packs

Self-hosted unmanaged asset packs

Unmanaged asset downloads

Errors

Enumerations