Is there a way to get the iTunes Store ID for a song from an MPMediaItem
?
I'm trying to pull the user's playlists, transfer those to another device, then play the songs using MPMusicPlayerController's setQueueWithStoreIDs
. This would require mapping the MPMediaItem
s to content in the iTunes Store, which is the purpose of iTunes Match, which is included in an Apple Music subscription.
Theoretically, this should be possible for songs that were matched to iTunes content. However, I can't find a property or valueForKey
on MPMediaItem
or any other class in MPMediaPlayer
framework that supports this. The persistentId
set of properties are local DB keys and don't tie back to the iTunes content for the item. They don't seem to be the same across devices for the same user either.
This is now possible in iOS 10.3+ using the playbackStoreID
instance property on MPMediaItem
.
https://developer.apple.com/documentation/mediaplayer/mpmediaitem/2813404-playbackstoreid
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With