我知道我可以通过执行以下操作来检索MPMediaItem的图片:
MPMediaItemCollection *collection;
/* Get media item collection here */
MPMediaItem *item = [[collection items] objectAtIndex:0];
MPMediaItemArtwork *artwork = [item valueForKey:MPMediaItemPropertyArtwork];我想用另一个图片替换这个图片。我该如何做到这一点呢?
我尝试了以下方法,但不起作用。
UIImage *newImage;
/* get image here */
MPMediaItemArtwork *artwork = [[MPMediaItemArtwork alloc] initWithImage:newImage];
[item setValue:artwork forKey:MPMediaItemPropertyArtwork];将抛出运行时异常,并显示以下消息:
this class is not key value coding-compliant for the key artwork.
发布于 2012-06-14 04:16:11
API是不可变的--你不能使用MPMediaItems来改变iPod库中的任何东西。
http://developer.apple.com/library/ios/#documentation/Audio/Conceptual/iPodLibraryAccess_Guide/AboutiPodLibraryAccess/AboutiPodLibraryAccess.html#//apple_ref/doc/uid/TP40008765-CH103-SW9
https://stackoverflow.com/questions/11022604
复制相似问题