Is it possible? I haven't found anything like this in MPMediaItemProperty... strings. Maybe private API?
-
Did you ever get a solution for this? – newenglander May 12 '16 at 15:07
2 Answers
Looking through the documentation, the methods list doesn't have a field for it. This leaves you with the option of extending MPMediaItem
with a new MPMediaItemProperty
for the 'date added' field yourself. Of course, this only works going forward.
Alternatively, you could parse the iTunes Library XML item and compare fields to the MPMediaItem
you're using. There is a key
tag for 'Date Modified' that has the conventional filesystem 'Date Modified' information (presumably from when the file was added to iTunes), but which is basically when the file was ripped or added unless you're modifying your MP3 files. So it's not strictly what you're looking for, but it's the closest general analogue I can think of.
You may want to see if there is a way of finding the Track ID key directly from the file or MPMediaItem
as well which may give you a faster search through the iTunes Library XML file. Try the MPMediaItemPropertyPersistentID
-based methods---one of these should correspond to the hex identifier in the 'Persistent ID' key
field of the iTunes Library XML file.

- 186
- 1
- 1
- 7
-
1@ascentruy - You suggest that it is possible to extend MPMediaItem with a new MPMediaItemProperty for the 'date added' field. Could you elaborate how you would programmatically detect the when a new media item is added to the library and how you would extend MPMediaItem with a new MPMediaItemProperty? Are you specifying a solution that is for an iMac or for an iPhone? – JeffB6688 Apr 05 '13 at 20:14
https://stackoverflow.com/a/38826548/899490
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

- 1
- 1

- 335
- 1
- 6
- 17