Contents

PHFetchOptions

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

Declaration

class PHFetchOptions

Mentioned in

Overview

Using class methods on the PHAsset, PHCollection, PHAssetCollection, and PHCollectionList classes to fetch assets or collections produces a PHFetchResult object containing the requested objects. The options you specify control which objects the fetch result includes, how those objects are arranged in the fetch result, and how Photos should notify your app of changes to the fetch result.

Photos supports only a restricted set of keys for the predicate and sortDescriptors properties. The set of available keys depends on which class you’re using to fetch assets or collections. The following table lists the keys supported by each class:

Class for Fetch Method

Supported Keys

Phasset

SELF, Localidentifier, Creationdate, Modificationdate, Mediatype, Mediasubtypes, Duration, Pixelwidth, Pixelheight, Isfavorite (or isFavorite), Ishidden (or isHidden), Burstidentifier

Phassetcollection

SELF, Localidentifier, Localizedtitle (or title), Startdate, Enddate, Estimatedassetcount

Phcollectionlist

SELF, Localidentifier, Localizedtitle (or title), Startdate, Enddate

Phcollection (can fetch a mix of Phcollectionlist and Phassetcollection objects)

SELF, Localidentifier, Localizedtitle (or title), Startdate, Enddate

Topics

Sorting and Filtering Fetch Results

Subscribing to Changes

Limiting Fetch Results

See Also

Asset retrieval