I am working on an iOS app and I need to determine if a song has album art. I am using the MPMusicPlayerController to access the native iOS music library and I am using a MPMediaItemArtwork to capture the artwork sent from the iOS music library. This is the coding I use to get the artwork:
MPMediaItemArtwork *mpArt = [mpSong valueForProperty:MPMediaItemPropertyArtwork];
To test if artwork is present I use this:
if (mpArt)
{
imgArt = [mpArt imageWithSize:CGSizeMake(250, 250)];
}
else
{
imgArt = [UIImage imageNamed:@"Alternative_Artwork_Image.jpg"];
}
No matter what the song's artwork is, the result is always true.
Any help would be appreciated. Thank you in advance.
I think it will always return true if it is an iCloud selection because it will eventually download. Try looking for a correlation with MPMediaItemPropertyIsCloudItem
You can also try getting info from the bounds... perhaps the bounds is 0x0 when the image is not found.