我有以下代碼從MPMediaItemPropertyArtWork獲取UIImage以在我的視圖中顯示coverArt。我從mediaItem中獲得一個非NULL圖形,但是,當我嘗試從圖稿中提取UIImage時,它會返回NULL,並且在我的UIImageView中看不到任何東西。任何幫助將不勝感激。無法從MPMediaItemPropertyArtWork獲取UIImage
CGSize artworkSize = CGSizeMake(30, 30);
UIImage *artworkImage;
MPMediaItemArtwork *artwork = [song valueForProperty: MPMediaItemPropertyArtwork];
if (artwork) {
NSLog(@"artwork available");
artworkImage = [artwork imageWithSize:artworkSize];
} else {
NSLog(@"artwork not available");
artworkImage = [UIImage imageNamed:@"EmptyAlbum.png"];
}
NSLog(@"artworkImage = %@", artworkImage);
coverArtView.image = artworkImage;
您是否發現任何解決方案? – Bartu
可能重複的[MPMediaItemArtwork爲空,而覆蓋在iTunes中可用](http://stackoverflow.com/questions/25998621/mpmediaitemartwork-is-null-while-cover-is-available-in-itunes) –