Type Method

supportsAssetResourceTypes:

Returns a Boolean value indicating whether Photos supports creating an asset with the specified combination of resource types.

Declaration

+ (BOOL)supportsAssetResourceTypes:(NSArray<NSNumber *> *)types;

Parameters

types

An array of numbers, each the raw value of a PHAssetResourceType identifier.

Return Value

YES if Photos supports the specified combination of resource types; otherwise, NO.

Discussion

When you request creation of an asset from resource data, Photos does not validate that the resources can construct a complete asset until the complete PHPhotoLibrary performChanges:completionHandler: change block executes. (If an asset cannot be constructed from the provided resources, Photos calls the completionHandler you provide in that method with an error describing the failure.) To perform preflight validation before executing an asset creation request, use this method to verify that the set of resource types from which you want to create an asset are correct.

This method verifies only that the collection of asset resource types is valid (for example, ensuring that you do not attempt to construct a photo asset without image data), so it is still possible for an asset creation request to fail if the data itself is incomplete or invalid. However, calling by using this method you can avoid some kinds of asset creation failure before performing the expensive operation of reading (and potentially downloading or transmitting) asset resource data.