3

I'm developing a iOS media Player using the iPodMusicPlayer. I have a UITableView with the MPMediaPickerController selector.

After buying a song from the iTunes store, the picked track has no artwork in the iPodMusicPlayer:

MPMediaPlayer* player = [MPMediaPlayer iPodMusicPlayer];
MPMediaItem*item = [player nowPlayingItem];
MPMediaItemArtwork *artwork = [item valueForProperty:MPMediaItemPropertyArtwork];
UIImage *albumCoverArt = [artwork imageWithSize:CGSizeMake(100.0f, 100.0f)];
if(albumCoverArt!=nil) {
   // do something
}
else {
  // nil before sync
}

After syncing with iTunes the song reveals the artwork.

Since before syncing, the iPod player shows the artwork, I think I'm missing something in the code when requesting the item to the MPMediaLibrary.

Any idea?

atxe
  • 5,029
  • 2
  • 36
  • 50
loretoparisi
  • 15,724
  • 11
  • 102
  • 146
  • This problem seems to be fixed in iOS 5.0. I tested it out, and now after buying a track and getting back to your application, the artwork will shows up. – loretoparisi Nov 15 '11 at 13:23

1 Answers1

1

I am having the same issue.

Seems like when you buy a song from the iTunes store directly on your iPhone, retrieving the artwork will give you a blank image.

After syncing your phone with iTunes, solves it and then you will get the right image from MPMediaItemArtwork.

Offcourse I would suspect the right image immediately after buying from iTunes.

Mark
  • 2,714
  • 1
  • 14
  • 17
  • You're right. Also, if you play that song from the iPod player, you will see the artwork in the iPod Player. So, it seems strange to me having the right arwork for that MPMediaItem just after syncing. – loretoparisi May 31 '11 at 08:03