Reputation: 12181
I want to be able to pull out the user's 50 most recently played songs, then be able to sort that via artist/album/genre etc. How can I make this happen immediately upon the app's opening and what would be the best way (I'm thinking dictionary?) to bundle this up so I can send it to a server?
Thanks!
Upvotes: 1
Views: 82
Reputation: 5050
MPMediaItemPropertyLastPlayedDate might be what you're looking for. See this related question for how to access the various media item properties.
Your app delegate's applicationDidBecomeActive:
method would be an appropriate place to scan on-launch, and an NSDictionary converted to JSON should be suitable serialization format.
Be sure to inform the user before sending their data off to your server, however.
Upvotes: 1