An iOS device can be used for the same purpose as the original iPod — to hold and play music, podcasts, and audiobooks. These items constitute the device’s music library. (The relevant guide in Apple’s documentation, iPod Library Access Programming Guide, preserves a more archaic name.) iOS provides the programmer with various forms of access to the device’s music library; you can:
These abilities are provided by the Media Player framework; you’ll need to
Everything in the music library, as seen by your code, is an MPMediaEntity. This is an abstract class that endows its subclasses with the ability to describe themselves through key–value pairs called properties.
The property keys have names like
MPMediaItemPropertyTitle. To fetch a property’s value, call
valueForProperty: with its key. You can fetch multiple properties with
enumerateValuesForProperties:usingBlock:. Thus, the use of the word “properties” here has nothing to do with object properties; these properties are more like entries in an NSDictionary. However, starting in iOS 7, an MPMediaEntity is endowed with some object properties whose names correspond to the property names. Thus, for example, you can say either