Mac Developer Library

Developer

iTunes Library Framework Reference

Introduction

Classes  

The iTunes Library framework provides facilities for retrieving the properties of media items in a user’s iTunes library. This framework was designed to replace the iTunes XML file that developers query to fetch track and playlist metadata. iTunes library access is read-only.

To use this framework, create an ITLibrary object by calling the libraryWithAPIVersion class method, as shown in Listing I-1. You can interrogate the instance returned to obtain its properties and the properties of its media items. For example:

Listing I-1Creating and initializing an ITLibrary
  • #import <iTunesLibrary/ITLibrary.h>
  • NSError *error = nil;
  • ITLibrary *library = [ITLibrary libraryWithAPIVersion:@"1.0" error:&error];
  • if (library)
  • {
  • NSArray *playlists = library.allPlaylists; // <- NSArray of ITLibPlaylist
  • NSArray *tracks = library.allMediaItems; // <- NSArray of ITLibMediaItem
  • }

To use the iTunes Library framework in your project, you must add the iTunes Library framework (located at /Library/Frameworks/iTunesLibrary.framework) to the project. You will also need to edit the build setting “FRAMEWORK_SEARCH_PATHS” to include /Library/Frameworks/iTunesLibrary.framework. The iTunes Library framework is available to users running iTunes v11.0 or above.

Classes

ITLibAlbum

Describes the class that provides basic facilities for retrieving the properties of an album in the iTunes library.

ITLibArtist

Describes the class that provides basic facilities for retrieving the properties of an artist in the iTunes library.

ITLibArtwork

Describes the class for retrieving the properties of the artwork attached to a media item in the iTunes library.

ITLibMediaEntity

Describes the class that provides basic facilities for retrieving the properties of a media entity in the iTunes library.

ITLibMediaItem

Describes the class that provides basic facilities for retrieving the properties of a media item in the iTunes library.

ITLibMediaItemVideoInfo

Describes facilities for retrieving the properties of a video media item in the iTunes library.

ITLibPlaylist

Describes the class that provides basic facilities for retrieving the properties of a playlist in the iTunes library.

ITLibrary

Describes the class that serves as the entry point to the iTunesLibrary framework.