Platforms to show: All Mac Windows Linux Cross-Platform
PHAssetCreationRequestMBS class
Super class: PHAssetChangeRequestMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Photos | MBS Mac64bit Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
A PHAssetCreationRequestMBS object, used within a photo library change block, constructs a new photo or video asset from data resources, and adds it to the Photos library. This class works in terms of the raw data resources that together form an asset, so you can use it together with the PHAssetResource class to perform a complete copy (or backup and restore) of an asset’s underlying resources. To instead simply create a new asset from an image object, image file, or video file, see the superclass PHAssetChangeRequestMBS.
To create a new asset from data resources, first start a change block using the shared PHPhotoLibraryMBS method performChanges or performChangesAndWait. Then, within the change block:
1. Within the change block, create a new asset creation request with the creationRequestForAsset method.
2. Add image, video, or data resources using the methods listed in Providing Data Resources for the New Asset.
3. (Optional.) Set metadata for the new asset using methods and properties of the superclass PHAssetChangeRequestMBS.
After Photos runs the change block and calls your completion handler, the new asset is created in the Photos library.
If you instantiate or use this class outside a photo library change block, Photos throws an exception. For details on change blocks, see PHPhotoLibrary.
Subclass of the PHAssetChangeRequestMBS class.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.
- 4 methods
- method addResource(type as Integer, data as MemoryBlock, options as PHAssetResourceCreationOptionsMBS = nil)
- method addResource(type as Integer, data as String, options as PHAssetResourceCreationOptionsMBS = nil)
- method addResource(type as Integer, file as FolderItem, options as PHAssetResourceCreationOptionsMBS = nil)
- method Constructor Private
- 3 shared methods
- shared method available as boolean
- shared method creationRequestForAsset as PHAssetCreationRequestMBS
- shared method supportsAssetResourceTypes(types() as Integer) as Boolean
- 12 constants
Resource Types
Constant | Value | Description |
---|---|---|
TypeAdjustmentBasePairedVideo | 11 |
The resource provides an unaltered version of the video data for a Live Photo asset for use in reconstructing recent edits. Requires MacOS 10.15 or newer. |
TypeAdjustmentBasePhoto | 8 |
The resource provides an unaltered version of its photo asset for use in for use in reconstructing recent edits. |
TypeAdjustmentBaseVideo | 12 |
The resource provides an unaltered version of the video data for video asset for use in reconstructing recent edits. Requires MacOS 10.15 or newer. |
TypeAdjustmentData | 7 |
The resource provides data for use in reconstructing recent edits to its asset. |
TypeAlternatePhoto | 4 |
The resource provides photo data that is not the primary form of its asset. |
TypeAudio | 3 |
The resource provides original audio data for its asset. |
TypeFullSizePairedVideo | 10 |
The resource provides the current video data component of a Live Photo asset. Requires MacOS 10.15 or newer. |
TypeFullSizePhoto | 5 |
The resource provides photo data at the highest available size and quality for its asset. |
TypeFullSizeVideo | 6 |
The resource provides video data at the highest available size and quality for its asset. |
TypePairedVideo | 9 |
The resource provides the original video data component of a Live Photo asset. |
TypePhoto | 1 |
The resource provides original photo data for its asset. |
TypeVideo | 2 |
The resource provides original video data for its asset. |
Super class PHAssetChangeRequestMBS
- 7 properties
- property contentEditingOutput as PHContentEditingOutputMBS
- property creationDate as Date
- property creationDateTime as DateTime
- property Favorite as Boolean
- property Hidden as Boolean
- property location as Variant
- property placeholderForCreatedAsset as PHObjectPlaceholderMBS
- 2 methods
- method Constructor
- method revertAssetContentToOriginal
- 6 shared methods
- shared method available as boolean
- shared method changeRequestForAsset(asset as PHAssetMBS) as PHAssetChangeRequestMBS
- shared method creationRequestForAssetFromImage(image as NSImageMBS) as PHAssetChangeRequestMBS
- shared method creationRequestForAssetFromImageAtFile(file as FolderItem) as PHAssetChangeRequestMBS
- shared method creationRequestForAssetFromVideoAtFileURL(file as FolderItem) as PHAssetChangeRequestMBS
- shared method deleteAssets(assets() as PHAssetMBS)
This class has no sub classes.
The items on this page are in the following plugins: MBS Mac64bit Plugin.
PHAssetCollectionMBS - PHAssetMBS