Get date when MPMediaItem was added to iTunes library

Is it possible? I didn't find anything like this in the MPMediaItemProperty files .... Maybe a private API?

+3


source to share


2 answers


Looking through the documentation, the list of methods has no field for it. This gives you the option to expand MPMediaItem

with a new one MPMediaItemProperty

for the "date added" field. Of course, this is only going on.

Alternatively, you can parse the iTunes library XML element and compare the fields with MPMediaItem

which you are using. There is a tag key

for "Date Modified" which has the standard file system "Date Modified" information (presumably when the file was added to iTunes), but this is basically when the file was ripped or added if you don't modify your MP3 files. So this is not strictly what you are looking for, but it is the closest generic analogue I can think of.



You might want to know if there is a way to find the track id key directly from the file, or MPMediaItem

, which might also lead to faster searches through the iTunes library XML file. Try methods based on MPMediaItemPropertyPersistentID

--- one of them must match the hexadecimal identifier in the "Persistent identifier" field of the key

iTunes library XML file.

+2


source


fooobar.com/questions/1897725 / ...



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