Instance Method

cancelImageRequest(_:)

Cancels an asynchronous request

Declaration

func cancelImageRequest(_ requestID: PHImageRequestID)

Parameters

requestID

The numeric identifier of the request to be canceled.

Discussion

When you perform an asynchronous request for image data using the requestImage(for:targetSize:contentMode:options:resultHandler:) method, or for a video object using one of the methods listed in Requesting Video Objects, the image manager returns a numeric identifier for the request. To cancel the request before it completes, provide this identifier when calling the cancelImageRequest(_:) method.

See Also

Canceling a Request

typealias PHImageRequestID

A numeric identifier for an asynchronous image request.

let PHInvalidImageRequestID: PHImageRequestID

A special value provided for asynchronous image requests that cannot be canceled.