Class

PHAssetCollection

A representation of a Photos asset grouping, such as a moment, user-created album, or smart album.

Declaration

@interface PHAssetCollection : PHCollection

Overview

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:options:. To find asset collections, use one of the methods listed in Fetching Asset Collections.

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 PHAssetCollectionChangeRequest object within a photo library change block. For details on using change requests and change blocks to update the photo library, see PHPhotoLibrary.

Topics

Fetching Asset Collections

+ fetchAssetCollectionsWithLocalIdentifiers:options:

Retrieves asset collections with the specified unique identifiers.

+ fetchAssetCollectionsWithType:subtype:options:

Retrieves asset collections of the specified type and subtype.

+ fetchAssetCollectionsContainingAsset:withType:options:

Retrieves asset collections of the specified type containing the specified asset.

+ fetchAssetCollectionsWithALAssetGroupURLs:options:

Retrieves asset collections using URLs provided by the Assets Library framework.

+ fetchMomentsInMomentList:options:

Retrieves asset collections in the specified moment list collection.

Deprecated
+ fetchMomentsWithOptions:

Retrieves asset collections corresponding to moments seen in the Photos app.

Deprecated

Reading Asset Collection Metadata

assetCollectionType

The type of the asset collection, such as an album or a moment.

PHAssetCollectionType

Major distinctions between kinds of asset collections, used by the assetCollectionType property and the fetchAssetCollectionsContainingAsset:withType:options: and fetchAssetCollectionsWithType:subtype:options: methods.

assetCollectionSubtype

The subtype of the asset collection.

PHAssetCollectionSubtype

Minor distinctions between kinds of asset collections, used by the assetCollectionSubtype property and the fetchAssetCollectionsWithType:subtype:options: method.

estimatedAssetCount

The estimated number of assets in the asset collection.

startDate

The earliest creation date among all assets in the asset collection.

endDate

The latest creation date among all assets in the asset collection.

approximateLocation

A location representing those of all assets in the collection.

localizedLocationNames

The names of locations grouped by the collection (an array of NSString objects).

Creating Temporary Asset Collections

+ transientAssetCollectionWithAssets:title:

Creates a temporary asset collection containing the specified assets.

+ transientAssetCollectionWithAssetFetchResult:title:

Creates a temporary asset collection containing the assets from the specified fetch result.

Relationships

Inherits From

See Also

Asset Retrieval

Fetching Objects and Requesting Changes

Get assets, asset collections, and collection lists matching a specified query.

PHAsset

A representation of an image, video, or Live Photo in the Photos library.

PHCollection

The abstract superclass for Photos asset collections and collection lists.

PHCollectionList

A group containing Photos asset collections, such as Moments, Years, or folders of user-created albums.

PHObject

The abstract superclass for Photos model objects (assets and collections).

PHFetchResult

An ordered list of assets or collections returned from a Photos fetch method.

PHFetchOptions

A set of options that affect the filtering, sorting, and management of results that Photos returns when you fetch asset or collection objects.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software