Contents

NSBundleResourceRequest

A resource manager you use to download content hosted on the App Store at the time your app needs it.

Declaration

class NSBundleResourceRequest

Overview

You identify on-demand resources during development by creating string identifiers known as tags and assigning one or more tags to each resource. An NSBundleResourceRequest object manages the resources marked by one or more tags.

You use the resource request to inform the system when the managed tags are needed and when you have finished accessing them. The resource request manages the downloading of any resources marked with the managed tags that are not already on the device and informs your app when the resources are ready for use.

The system will not attempt to purge the resources marked with a tag from on-device storage as long as at least one NSBundleResourceRequest object is managing the tag. Apps can access resources after the completion handler of either beginAccessingResources(completionHandler:) or conditionallyBeginAccessingResources(completionHandler:) is called successfully. Management ends after a call to endAccessingResources() or after the resource request object is deallocated.

Other properties and methods let you track the progress of a download, change the priority of a download, and check whether the resources marked by a set of tags are already on the device. Methods in Bundle indicate to the system the relative importance of preserving a tag in memory after it is no longer in use. For more information, see setPreservationPriority(_:forTags:) and preservationPriority(forTag:).

Topics

Initializing a Resource Request

Accessing the Configuration

Requesting Resources

Setting the Download Priority

Tracking Progress

Errors

Notifications

Structures