Get date when MPMediaItem was added to iTunes library
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.
source to share
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 to share