Platforms to show: All Mac Windows Linux Cross-Platform

Back to PHAssetCreationRequestMBS class.

PHAssetCreationRequestMBS.available as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Checks whether class is available.

Should return true on MacOS 10.15 or newer.

PHAssetCreationRequestMBS.creationRequestForAsset as PHAssetCreationRequestMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Creates a request for adding a new asset to the Photos library using asset resources.

Call this method within a photo library change block to create a new asset. For details on change blocks, see PHPhotoLibraryMBS. After calling this method, and before returning from the change block use the methods listed in Providing Data Resources for the New Asset to specify one or more data resources for the asset.

To set metadata properties of the newly created asset, use the corresponding properties of the change request (provided by the superclass PHAssetChangeRequestMBS and listed in Modifying Assets). To reference the newly created asset later in the same change block or after the change block completes, use the placeholderForCreatedAsset property to retrieve a placeholder object.

PHAssetCreationRequestMBS.supportsAssetResourceTypes(types() as Integer) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns a Boolean value indicating whether Photos supports creating an asset with the specified combination of resource types.

types: An array of numbers, each the raw value of a PHAssetResourceType identifier.
Return true if Photos supports the specified combination of resource types; otherwise, false.

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 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.

The items on this page are in the following plugins: MBS Mac64bit Plugin.


The biggest plugin in space...