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