Platforms to show: All Mac Windows Linux Cross-Platform
PHAssetCollectionMBS class
Super class: PHCollectionMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Photos | MBS Mac64bit Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
In the Photos framework, collection objects (including asset collections) do not directly reference their member objects, and there are no other objects that directly reference collection objects. To retrieve the members of an asset collection, fetch them with a PHAsset class method such as fetchAssetsInAssetCollection. To find asset collections, use one of the methods listed in Fetching Asset Collections.
Important
Accessing or modifying the Photos library requires explicit authorization from the user. The first time you call one of the methods listed in Fetching Asset Collections, Photos automatically prompts the user for authorization. (Alternatively, you can use the PHPhotoLibraryMBS.requestAuthorization method to prompt the user at a time of your choosing.)
Your app’s Info.plist file must provide a value for the NSPhotoLibraryUsageDescription key that explains to the user why your app is requesting Photos access. Apps linked on or after iOS 10.0 will crash if this key is not present.
Like assets and collection lists, asset collections are immutable. To create, rename, or delete asset collections, or to add, remove, or rearrange members in an asset collection, create a PHAssetCollectionChangeRequestMBS object within a photo library change block. For details on using change requests and change blocks to update the photo library, see PHPhotoLibraryMBS.
Subclass of the PHCollectionMBS class.
- 8 properties
- property approximateLocation as Variant
- property assetCollectionSubtype as Integer
- property assetCollectionType as Integer
- property endDate as Date
- property endDateTime as DateTime
- property estimatedAssetCount as Integer
- property startDate as Date
- property startDateTime as DateTime
- 2 methods
- method Constructor
- method localizedLocationNames as String()
- 7 shared methods
- shared method available as boolean
- shared method fetchAssetCollectionsContainingAsset(asset as PHAssetMBS, type as Integer, options as PHFetchOptionsMBS = nil) as PHFetchResultMBS
- shared method fetchAssetCollectionsWithALAssetGroupURLs(assetGroupURLs() as string, options as PHFetchOptionsMBS = nil) as PHFetchResultMBS
- shared method fetchAssetCollectionsWithLocalIdentifiers(identifiers() as string, options as PHFetchOptionsMBS = nil) as PHFetchResultMBS
- shared method fetchAssetCollectionsWithType(type as Integer, subType as integer, options as PHFetchOptionsMBS = nil) as PHFetchResultMBS
- shared method transientAssetCollectionWithAssetFetchResult(fetchResult as PHAssetMBS, title as string) as PHAssetCollectionMBS
- shared method transientAssetCollectionWithAssets(assets() as PHAssetMBS, title as string) as PHAssetCollectionMBS
- 31 constants
SubTypes
Constant | Value | Description |
---|---|---|
SubtypeAlbumCloudShared | 101 |
An iCloud Shared Photo Stream. |
SubtypeAlbumImported | 6 |
An album imported from a camera or external storage. |
SubtypeAlbumMyPhotoStream | 100 |
The user’s personal iCloud Photo Stream. |
SubtypeAlbumRegular | 2 |
An album created in the Photos app. |
SubtypeAlbumSyncedAlbum | 5 |
An album synced to the device from iPhoto. |
SubtypeAlbumSyncedEvent | 3 |
An Event synced to the device from iPhoto. |
SubtypeAlbumSyncedFaces | 4 |
A Faces group synced to the device from iPhoto. |
SubtypeAny | -1 |
A bit mask representing all possible subtypes. |
SubtypeSmartAlbumAllHidden | 205 |
A smart album that groups all assets hidden from the Moments view in the Photos app. |
SubtypeSmartAlbumAnimated | 214 |
A smart album that groups all image animation assets. |
SubtypeSmartAlbumBursts | 207 |
A smart album that groups all burst photo sequences in the photo library. |
SubtypeSmartAlbumCinematic | 218 |
A Smart Album that groups all cinematic photo assets. |
SubtypeSmartAlbumDepthEffect | 212 |
A smart album that groups all images captured using the Depth Effect camera mode on compatible devices. |
SubtypeSmartAlbumFavorites | 203 |
A smart album that groups all assets that the user has marked as favorites. |
SubtypeSmartAlbumGeneric | 200 |
A smart album of no more specific subtype. |
SubtypeSmartAlbumLivePhotos | 213 |
A smart album that groups all Live Photo assets. |
SubtypeSmartAlbumLongExposures | 215 |
A smart album that groups all Live Photo assets where the Long Exposure variation is enabled. |
SubtypeSmartAlbumPanoramas | 201 |
A smart album that groups all panorama photos in the photo library. |
SubtypeSmartAlbumRAW | 217 |
A Smart Album that groups all RAW assets in the photo library. |
SubtypeSmartAlbumRecentlyAdded | 206 |
A smart album that groups assets that were recently added to the photo library. |
SubtypeSmartAlbumScreenshots | 211 |
A smart album that groups all images captured using the device’s screenshot function. |
SubtypeSmartAlbumSelfPortraits | 210 |
A smart album that groups all photos and videos captured using the device’s front-facing camera. |
SubtypeSmartAlbumSlomoVideos | 208 |
A smart album that groups all Slow-Mo videos in the photo library. |
SubtypeSmartAlbumSpatial | 219 |
A Smart Album that groups spatial videos in the photo library. |
SubtypeSmartAlbumTimelapses | 204 |
A smart album that groups all time-lapse videos in the photo library. |
SubtypeSmartAlbumUnableToUpload | 216 |
Unable to upload album. |
SubtypeSmartAlbumUserLibrary | 209 |
A smart album that groups all assets that originate in the user’s own library (as opposed to assets from iCloud Shared Albums). |
SubtypeSmartAlbumVideos | 202 |
A smart album that groups all video assets in the photo library. |
Types
Constant | Value | Description |
---|---|---|
TypeAlbum | 1 |
An album in the Photos app. |
TypeMoment | 3 |
A moment in the Photos app. Deprecated by Apple. |
TypeSmartAlbum | 2 |
A smart album whose contents update dynamically. |
Super class PHCollectionMBS
- 3 properties
- property canContainAssets as Boolean
- property canContainCollections as Boolean
- property localizedTitle as String
- 2 methods
- method canPerformEditOperation(anOperation as Integer) as Boolean
- method Constructor
- 3 shared methods
- shared method available as boolean
- shared method fetchCollectionsInCollectionList(collectionList as PHCollectionListMBS, options as PHFetchOptionsMBS = nil) as PHFetchResultMBS
- shared method fetchTopLevelUserCollections(options as PHFetchOptionsMBS = nil) as PHFetchResultMBS
- 7 constants
Edit Operations
Constant | Value | Description |
---|---|---|
EditOperationAddContent | 3 |
The collection supports adding items that already exist elsewhere in the photo library. |
EditOperationCreateContent | 4 |
The collection supports creating new items. |
EditOperationDelete | 6 |
The collection itself can be deleted. |
EditOperationDeleteContent | 1 |
The collection supports deleting the items it contains. |
EditOperationRearrangeContent | 5 |
The collection supports reordering the arrangement of items it contains. |
EditOperationRemoveContent | 2 |
The collection supports removing the items it contains. |
EditOperationRename | 7 |
The collection itself can be renamed. |
Super class PHObjectMBS
- 2 properties
- property Handle as Integer
- property localIdentifier as String
- 2 methods
- method Constructor Private
- method copy as PHObjectMBS
- shared method available as boolean
Sub classes:
Blog Entries
Release notes
- Version 25.1
- Added more constants to PHAssetMBS, PHAssetCollectionMBS and PHAssetCreationRequestMBS classes.
Some methods using this class:
- PHAssetCollectionChangeRequestMBS.changeRequestForAssetCollection(assetCollection as PHAssetCollectionMBS) as PHAssetCollectionChangeRequestMBS
- PHAssetCollectionChangeRequestMBS.changeRequestForAssetCollection(assetCollection as PHAssetCollectionMBS, assets as PHFetchResultMBS) as PHAssetCollectionChangeRequestMBS
- PHAssetMBS.fetchAssetsInAssetCollection(assetCollection as PHAssetCollectionMBS, options as PHFetchOptionsMBS = nil) as PHFetchResultMBS
- PHAssetMBS.fetchKeyAssetsInAssetCollection(assetCollection as PHAssetCollectionMBS, options as PHFetchOptionsMBS = nil) as PHFetchResultMBS
Some examples using this class:
Some related classes:
- class PHAssetCollectionChangeRequestMBS
- class PHAssetCreationRequestMBS
- class PHAssetMBS
- class PHCollectionListMBS
- class PHCollectionMBS
- class PHFetchOptionsMBS
- class PHFetchResultMBS
- class PHObjectMBS
- class PHPhotoLibraryMBS
- class PHProjectMBS
The items on this page are in the following plugins: MBS Mac64bit Plugin.
PHAssetCollectionChangeRequestMBS - PHAssetCreationRequestMBS
