Contents

creationRequestForDownloadJob(resource:)

Creates a download-only job request for the specified asset resource.

Declaration

class func creationRequestForDownloadJob(resource: PHAssetResource) -> Self

Parameters

  • resource:

    The asset resource to download.

Mentioned in

Return Value

A change request for the created job.

Discussion

This method registers a job that requests an asset resource be downloaded from iCloud to the device without uploading it to a remote server. The download operation is performed asynchronously by the system over time. This is useful when you need to ensure a resource is available locally for processing.

The job will transition through the same states as upload jobs (PHAssetResourceUploadJobStateRegistered, PHAssetResourceUploadJobStatePending, and eventually PHAssetResourceUploadJobStateSucceeded or PHAssetResourceUploadJobStateFailed), but will only perform a download operation.

Use fetchJobsWithAction:options: to check the job’s state. When the job reaches PHAssetResourceUploadJobStateSucceeded, the download has completed successfully.

See Also

Creating jobs