The abstract superclass for Photos asset collections and collection lists.
SDKs
- iOS 8+
- macOS 10.13+
- Mac Catalyst 13.0+
- tvOS 10+
Framework
- Photos
Declaration
class PHCollection : PHObject
Overview
You do not create or work with instances of this class directly. Instead, use one of its two concrete subclasses, PHAsset
or PHCollection
.
A
PHAsset
object represents a collection of photo or video assets, such as an album, moment, or Shared Photo Stream.Collection A
PHCollection
object represents a collection that contains other collections, such as a a folder containing albums or the set of all moments in a calendar year.List
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 Collections, 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.