A group containing Photos asset collections, such as Moments, Years, or folders of user-created albums.
SDKs
- iOS 8+
- macOS 10.13+
- Mac Catalyst 13.0+
- tvOS 10+
Framework
- Photos
Declaration
@interface PHCollectionList : 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 a collection list, fetch them with a PHCollection
class method such as fetch
. To find objects at the root of the collection list hierarchy (such as album folders with no parent folders), use the fetch
method.
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 Collection Lists, Photos automatically prompts the user for authorization. (Alternatively, you can use the PHPhoto
request
method to prompt the user at a time of your choosing.)
Your app’s Info
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 asset collections, collection lists are immutable. To create, rename, or delete collection lists, or to add, remove, or rearrange members in a collection list, create a PHCollection
object within a photo library change block. For details on using change requests and change blocks to update the photo library, see PHPhoto
.