Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPMediaQuery artistsQuery returns duplicates

I am using the Apple Media Player Framework in my application. To fetch items I am using the MPMediaQuery as described in their documents. Which works well, but when using the predefined query to retrieve all artists, I get duplicated entries for few artists.

Can somebody explain why there are duplicates? How do I suppress them?

NSArray *collections = [[MPMediaQuery artistsQuery] collections];

(And no there aren't any typos or differences in the casing in the name of the artist!)

like image 795
miho Avatar asked Nov 06 '12 18:11

miho


1 Answers

I've noticed that this occurs only when there are albums with multiple artists.

Instead of just [MPMediaQuery artistQuery], the following pretends this behavior:

MPMediaQuery *artistsQuery = [MPMediaQuery artistsQuery];
artistsQuery.groupingType = MPMediaGroupingAlbumArtist; 
NSArray *collections = [artistQuery collection];
like image 99
miho Avatar answered Oct 17 '22 17:10

miho