An object that represents the state of synced media items on a device.


@interface MPMediaLibrary : NSObject


A user may sync their device, changing the contents on the device, while your app is running. You can use the notification provided by this class to ensure that your app's cache of the user's library is up-to-date.

To retrieve media items from the media library, build a custom query as described in MPMediaPropertyPredicate and MPMediaQuery.


Getting the Default Media Library

+ requestAuthorization:

Displays a user interface so that the user can authorize whether your app may view the media library's contents.

+ authorizationStatus

Returns whether the app can access the user's media library.


The list of possible states for authorization to access to the user's media library.

+ defaultMediaLibrary

Returns an instance of the default media library.

Receiving Notifications when the User's Library Changes

- beginGeneratingLibraryChangeNotifications

Asks the media library to turn on notifications for whenever the library changes.

- endGeneratingLibraryChangeNotifications

Asks the media library to turn off notifications for whenever the library changes.


Indicates the media library has changed.


The calendar date on which the media library was last modified.

Retrieving a Playlist from the Media Library

- getPlaylistWithUUID:creationMetadata:completionHandler:

Retrieves an app maintained existing playlist or creates a new playlist when no playlist exists.

Adding an Item to the Media Library

- addItemWithProductID:completionHandler:

Adds the designated item to the user's music library.


Inherits From

Conforms To