Instance Method

addResourceWithType:data:options:

Adds a data resource to the asset being created, using the specified data.

Declaration

- (void)addResourceWithType:(PHAssetResourceType)type data:(NSData *)data options:(PHAssetResourceCreationOptions *)options;

Parameters

type

The role of this data resource in constructing an asset. For details, see PHAssetResourceType.

data

The data for the asset resource.

options

Options affecting how Photos constructs the asset resource and incorporates its data into the Photos library. For details, see PHAssetResourceCreationOptions.

Discussion

Photos imports the asset resource data only when it executes the PHPhotoLibrary change block in which you create a PHAssetCreationRequest object and call this method. If you attempt to create an asset with invalid data or an invalid combination of resources, Photos reports an error in the completion handler of your PHPhotoLibrary call.

See Also

Providing Data Resources for the New Asset

- addResourceWithType:fileURL:options:

Adds a data resource to the asset being created, using the file at the specified URL.