Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The easiest way to do this is to just use NSDictionary dictionaryWithContentsOfFile:</p> <pre><code>NSString* libraryPath = @"~/Music/iTunes/iTunes Music Library.xml"; NSDictionary* musicLibrary = [ NSDictionary dictionaryWithContentsOfFile: libraryPath ]; </code></pre> <p>Also note that users can move their music library so a more complete example is:</p> <pre><code>NSString* libraryPath = @"~/Music/iTunes/iTunes Music Library.xml"; NSUserDefaults* prefs = [ NSUserDefaults standardUserDefaults ]; [ prefs synchronize ]; NSDictionary* iAppsPrefs = [ prefs persistentDomainForName: @"com.apple.iApps" ]; NSArray* recentPaths = [ iAppsPrefs objectForKey: @"iTunesRecentDatabasePaths" ]; if( [ recentPaths count ] &gt; 0 ) { libraryPath = [ recentPaths objectAtIndex: 0 ]; } NSDictionary* musicLibrary = [ NSDictionary dictionaryWithContentsOfFile: libraryPath ]; </code></pre> <p>For really large libraries it can take several seconds to read the contents so it is best to do this on a thread.</p> <p>Once you have this loaded then look at the structure of iTunes Music Library.xml in a text editor to see how you will have to walk the tree to format the information in a way that is appropriate to your needs.</p> <p><strong>EDIT:</strong></p> <p>With iTunes 11 Apple is now providing a framework on OSX to access the iTunes library. Documentation can be found <a href="http://developer.apple.com/library/mac/#documentation/iTunesLibrary/Reference/iTunesLibraryFrameworkReference/_index.html" rel="nofollow">here</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload