A media query specifies a set of media items (instances of
MPMediaItem) from the iPod library by way of a filter and a grouping type. Filter and grouping type are both optional; an unqualified query matches the entire library.
- iOS 3.0+
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 methods described in
MPMediaPropertyPredicate, based on property keys described in
After creating and configuring a query, you use it to retrieve media items or media item collections. Collections are described in
MPMediaItemCollection. You can also use a query to retrieve an array of
MPMediaQuerySection instances, useful for displaying the results of a query in the user interface of your app. See the
This class includes a number of convenience constructors that each apply a grouping type and, in most cases, match a subset of the iPod library.
Table 1 summarizes the features of these constructors. See
MPMediaItem for descriptions of the entries in the Filter column. See
MPMediaGrouping for descriptions of the entries in the Grouping type column.
Matches entire iPod library