I think you are looking for MPMediaItemPropertyPlayCount , not MPMediaItemPropertyAlbumTrackCount. MPMediaItemPropertyAlbumTrackCount is the track number of the song that appears in his album.
MPMediaItemPropertyPlayCount , unfortunately, cannot be used to create queries using MPMediaQuery, since it is a user-defined property.
Your best option is to store all playback counters in a database, such as Core Data, when your application opens for the first time and updates it, recording notifications when the user library changes.
Steve moser
source share