Contents

MPMediaGrouping

Keys used to configure a media query.

Declaration

enum MPMediaGrouping

Overview

The following code snippet shows how to apply a grouping key:

After running these code lines, the collections array contains all the matched media items grouped and sorted according to album name.

To obtain a sorted list of songs, configure a media query with the MPMediaGroupingTitle key, or take advantage of the title key being the default for a media query. In either case, each obtained media item is, in effect, its own collection.

Collections sort according to the same rules used by iTunes on the desktop. This includes respecting the primary system language chosen by the user. The system ignores leading articles during sorting, including “A,” “An,” and “The” when using English, or “L’,” “La,” and “Le” when using French. If you need precise control over sorting, implement it in your application.

Topics

Media query keys

Initializers

See Also

Configuring media queries