Setting MPMediaItem's artwork
I know I can retrieve an MPMediaItem's artwork by doing the following:
MPMediaItemCollection *collection; /* Get media item collection here */ MPMediaItem *item = [[collection items] objectAtIndex:0]; MPMediaItemArtwork *artwork = [item valueForKey:MPMediaItemPropertyArtwork];
I would like to replace the artwork image with another. How would I accomplish this?
I tried the following but it doesn't work.
UIImage *newImage; /* get image here */ MPMediaItemArtwork *artwork = [[MPMediaItemArtwork alloc] initWithImage:newImage]; [item setValue:artwork forKey:MPMediaItemPropertyArtwork];
An run-time exception is thrown with the following message: this class is not key value coding-compliant for the key artwork.
MPMediaItems are immutable - you can't change anything in the iPod library using the API.