Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPMediaItemPropertyArtwork empty with Apple Music

I can't retrieve MPMediaItemPropertyArtwork while playing a song from Apple Music with iOS 8.4

I've try to read image of nowPlayingItem

(lldb) po [[[MPMusicPlayerController systemMusicPlayer] nowPlayingItem] valueForProperty:MPMediaItemPropertyArtwork] <MPConcreteMediaItemArtwork: 0x174478940>

But the object returned is empty:

(lldb) p (CGRect)[[[[MPMusicPlayerController systemMusicPlayer] nowPlayingItem] valueForProperty:MPMediaItemPropertyArtwork] bounds] (CGRect) $2 = (origin = (x = 0, y = 0), size = (width = 0, height = 0))

And obviously the returned image is always nil

there's another way to get the nowPlayingItem MPMediaItemPropertyArtworkimage?

like image 423
Martino Bonfiglioli Avatar asked Nov 09 '22 10:11

Martino Bonfiglioli


1 Answers

This behaviour happens when you are streaming songs from Apple Music which are not saved to the users library.

I've filed a bug report for this, and I think you should do too 😉 You can dupe rdar://25413082 if you want.

The best workaround is to use the iTunes API (or similar) to retrieve the album Art although this won't give perfect results 100% of the time.

like image 92
Jordi Bruin Avatar answered Nov 15 '22 12:11

Jordi Bruin