Class

NKAssetDownload

An instance of the NKAssetDownload class represents an asset that is being downloaded (or has downloaded) for an issue of a Newsstand application.

Overview

An asset can be either a component of an issue—for example, an HTML file, a plain-text file, an image, or a video—or the entire issue compressed in a ZIP or other archive. The latter approach is recommended.

You create an NKAssetDownload instance using the NKIssue method addAsset(with:); you pass into this method an NSURLRequest object that contains the URL locating the asset on the application’s server. To begin downloading the asset, call download(with:) on the NKAssetDownload object. The delegate specified as the parameter of this message must adopt the NSURLConnectionDownloadDelegate protocol. It should implement the three methods specific to handling downloads of issue assets:

If a Newsstand application terminates while asset downloading is underway, the downloading continues in the background. When the asset is downloaded, the application is brought to the foreground if it has a newsstand-content value for the UIBackgroundModes array in the information property list. It should obtain an instance of NKIssue and iterate through the NKAssetDownload objects in the downloadingAssets array; for each object, call download(with:) on it and have the delegate process the remaining downloads.

Symbols

Downloading an Issue Asset

func download(with: NSURLConnectionDownloadDelegate)

Returns a connection object and starts downloading the issue asset with a specified delegate to handle callbacks.

Getting the Asset Identifier

var identifier: String

An identifier for the downloaded asset.

Accessing Asset Information

var userInfo: [AnyHashable : Any]?

Application-specific information that is saved with the asset-download object.

var urlRequest: URLRequest

The URL request associated with the asset download.

var issue: NKIssue?

The issue associated with the asset download.

Relationships

Inherits From

Conforms To