0

我知道我可以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.

4

1 回答 1

2

MPMediaItem 是不可变的——您不能使用 API 更改 iPod 库中的任何内容。

http://developer.apple.com/library/ios/#documentation/Audio/Conceptual/iPodLibraryAccess_Guide/AboutiPodLibraryAccess/AboutiPodLibraryAccess.html#//apple_ref/doc/uid/TP40008765-CH103-SW9

于 2012-06-13T20:16:11.000 回答