0

I'm using Objective-C, iOS 10 and iPad. I know how to get the list of albums made by an artist.

MPMediaQuery *albums=[MPMediaQuery albumsQuery];

MPMediaPropertyPredicate *artistName=[MPMediaPropertyPredicate predicateWithValue: @"some name" forProperty: MPMediaItemPropertyAlbumArtist];

[albums addFilterPredicate:artistName];

NSArray *albumsArray=albums.collections;

for(MPMediaItemCollection *albumCollection in albumsArray){
    NSString *albumTitle=[[albumCollection representativeItem] valueForProperty:MPMediaItemPropertyAlbumTitle];
    NSLog(@"%@",albumTitle);

}

The albumsQuery provided by Apple is sorted by album name.

I need to sort the albums by year.

danyadd
  • 119
  • 1
  • 2
  • 8
  • See http://stackoverflow.com/questions/4862646/get-album-year-for-item-in-ipod-library – rmaddy Nov 28 '16 at 23:54
  • @rmaddy Wow! That was a big help. Amazing that still in iOS 10 we have to use an undocumented way to obtain "Year" information. – danyadd Nov 29 '16 at 03:46

0 Answers0