问题
It seems that the property MPMediaItemPropertyAssetURL
on a MPMediaItem
returns null when the file is one that was from Apple Music and has been made "available offline".
On the other hand, items from my original library which I uploaded to iTunes match/apple music and then make available offline don't seem to have this problem.
Is this a bug? Have I done something wrong? Anyone having similar issues?
回答1:
It seems that Apple Music files are DRM-protected and subscription based, so probably Apple prohibits the use of references to these assets due to rights management.
Reference: https://forums.developer.apple.com/thread/7389
回答2:
Things have changed a little and this isn't true anymore. MPMediaItemPropertyAssetURL
is not nil on iOS 11 for songs saved offline via Apple Music but AVPlayer
is unable to play them since they are still DRM protected. The same song returns MPMediaItemPropertyAssetURL
nil on iOS 9.
If you are interested in checking for DRM protected songs or in playing such songs, you can read my detailed answer here: https://stackoverflow.com/a/47694472/4331787
来源:https://stackoverflow.com/questions/31364485/apple-music-offline-files-have-no-url