A query that specifies a set of media items from the device’s media library by way of a filter and a grouping type.
- iOS 3.0+
- Mac Catalyst 13.0+
- Media Player
Filter and grouping types are both optional; an unqualified query matches the entire library.
A query has at most one grouping type. A query’s filter can consist of any number of media property predicates. You build filters using
MPMedia objects, based on property keys described in
After creating and configuring a query, you use it to retrieve media items or media item collections. You can also use a query to retrieve an array of
MPMedia instances, useful for displaying the results of a query in the user interface of your app. See the
This class includes several convenience constructors that each apply a grouping type and, in most cases, match a subset of the library. Table 1 summarizes the features of these constructors. See
MPMedia for descriptions of the entries in the Filter column. See
MPMedia for descriptions of the entries in the Grouping type column.
Matches entire library