Instance Method

requestContentEditingInputWithOptions:completionHandler:

Requests asset information for beginning a content editing session.

Declaration

- (PHContentEditingInputRequestID)requestContentEditingInputWithOptions:(PHContentEditingInputRequestOptions *)options completionHandler:(void (^)(PHContentEditingInput *contentEditingInput, NSDictionary *info))completionHandler;

Parameters

options

Options affecting how Photos handles an edit session request.

completionHandler

A block that Photos calls when the requested asset editing information is ready.

The block takes the following parameters:

contentEditingInput

An object that describes the asset for editing and provides methods for loading the image or video content to be edited.

info

A dictionary providing information about the status of the request. See Editing Request Info Keys for possible keys and values.

In iOS 10.0, tvOS 10.0, and later, Photos always calls this block on the main queue. In earlier releases, Photos calls this block on an arbitrary serial queue—if your block needs to update the UI, dispatch that work to the main queue.

Return Value

A numeric identifier for the request. Pass this identifier to the cancelContentEditingInputRequest: method if you need to cancel the request before it completes.

Discussion

When you call this method, Photos downloads the asset’s image or video data (if necessary) and prepares it for editing, then calls your completionHandler block to provide a PHContentEditingInput object you use for editing.

To complete the edit, create a PHContentEditingOutput object from the editing input to provide the edited asset data. Then, commit the edit by posting a change block to the shared PHPhotoLibrary object. In the block, create a PHAssetChangeRequest object and set its contentEditingOutput property to the editing output you created.

See Also

Editing an Asset

Editing Asset Content

Make a request to modify and save a photo or video asset.

PHContentEditingInput

A container that provides information about and access to the image, video, or Live Photo content of an asset to be edited.

PHContentEditingOutput

A container to which you provide the results of editing the photo, video, or Live Photo content of a Photos asset.

PHAdjustmentData

A description of the edits made to an asset's photo, video, or Live Photo content, which allows your app to reconstruct or revert the effects of prior editing sessions.

PHContentEditingInputRequestOptions

A set of options affecting the delivery of image or video data when you request to edit the content of a Photos asset.

PHLivePhotoEditingContext

An editing session for modifying the photo, video, and audio content of a Live Photo.

PHLivePhotoFrame

A container that provides image content for a single frame of a Live Photo in an editing context.

- canPerformEditOperation:

Returns whether the asset supports the specified editing operation.

PHAssetEditOperation

Values identifying possible actions an asset can support, used by the canPerformEditOperation: method.

- cancelContentEditingInputRequest:

Cancels a request for editing the asset’s content.

PHContentEditingInputRequestID

An identifier for an asset content editing session.

Editing Request Info Keys

Keys indicating the status of an asset content editing request, used in the completion handler of the requestContentEditingInputWithOptions:completionHandler: method.