How Do You Obtain the “Purchase Date” or “Date Added” from MPMediaItems in iPod Library

戏子无情 提交于 2019-11-29 15:18:36

As you can see in Apple Documentation for MPMediaItem http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPMediaItem_ClassReference/Reference/Reference.html#//apple_ref/occ/cl/MPMediaItem, you access all the properties through enumerateValuesForProperties:usingBlock: or valueForProperty:, but there isn't a property for Date Added or Purchased Date informations.

This doesn't mean that the data isn't stored somewhere (surely it is): this just means that you cannot access that information through public APIs, maybe for privacy issues.

I don't know anyway if there is a way to obtain this information through some private API calls, but if it exists you can't use it for AppStore apps because it will cause you a rejection during review process.

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

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

As a Date object:

MPMediaItem.dateAdded

and as a String:

MPMediaItemPropertyDateAdded

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!