I have an albumId ( say "-7833645336740617216" ). I am looking at a method similar which can take this as an input, and return the MPMediaItemArtwork associated with this album.
Asked
Active
Viewed 451 times
1 Answers
0
One way is to fetch the album with a MPMediaPropertyPredicate
, and perform a MPMediaQuery
with the predicate. Then get the value of the MPMediaItemPropertyArtwork
property from the representative item of the album:
- (MPMediaItemArtwork *)albumArtworkForAlbumID:(NSNumber *)albumID
{
MPMediaPropertyPredicate *albumIDPredicate;
albumIDPredicate = [MPMediaPropertyPredicate predicateWithValue:albumID
forProperty:MPMediaItemPropertyAlbumPersistentID];
NSSet *predicateSet = [NSSet setWithObject:albumIDPredicate];
MPMediaQuery *albumQuery;
albumQuery = [[MPMediaQuery alloc] initWithFilterPredicates:predicateSet];
MPMediaItemCollection *album;
album = [albumQuery.collections firstObject];
return [album.representativeItem valueForProperty:MPMediaItemPropertyArtwork];
}

Bryan Luby
- 2,527
- 22
- 31