How to get "Purchase Date" or "Date Added" from MPMediaItems in iPod Library

Since users are downloading new songs to their iPod Music library from the iTunes Store, I would like to programmatically list these songs in a table. Is it possible to get "Date Added" or "Date Purchased" from MPMediaItemCollection? I see there are property keys like play counter and last date. I know the data exists because it can be viewed in iTunes, but I cannot find it. Any suggestions on where to find this or how to get it?

+3


source to share


2 answers


As you can see in Apple's documentation for MPMediaItem http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPMediaItem_ClassReference/Reference/Reference.html#//apple_ref/occ/cl/MPMediaItem you get access to all properties via enumerateValuesForProperties:usingBlock:

or valueForProperty:

, but no property exists for date or purchase information.

This does not mean that the data is not stored somewhere (it certainly is): it means that you cannot access this information through public APIs, possibly for privacy concerns.



I don't know at all if there is a way to get this information through some private API calls, but if it exists, you cannot use it for AppStore apps because it will cause a failure in the browsing process.

+2


source


As of iOS 10, we have access to two dateAdded properties.

Note. iOS 10 is still in beta (4) at the time of writing, so things could change.

As a Date object:

MPMediaItem.dateAdded

      



and as a line:

MPMediaItemPropertyDateAdded

      

source: https://developer.apple.com/library/prerelease/content/releasenotes/General/iOS10APIDiffs/Objective-C/MediaPlayer.html

+1


source







All Articles