Instance Method

setImageData(_:metadata:completionBlock:)

Replaces the image data in the receiver with given image data

Declaration

func setImageData(_ imageData: Data!, metadata: [AnyHashable : Any]!, completionBlock: ALAssetsLibraryWriteImageCompletionBlock!)

Parameters

imageData

Image data for the asset.

metadata

Metadata for the image.

completionBlock

The block invoked after the save operation completes.

If the application is able to edit the asset, the completion block returns the same asset URL as the receiver, because a new asset is not created.

If the application is not able to edit the asset, the completion blocks return a nil asset URL and an ALAssetsLibraryWriteFailedError.

Discussion

Before invoking this method, you should check the isEditable property of the asset to determine whether it is possible to replace the image data.

See Also

Setting New Image and Video Data

func setVideoAtPath(URL!, completionBlock: ALAssetsLibraryWriteVideoCompletionBlock!)

Replaces the video data in receiver with the video at a given URL.

Deprecated