-(void) mediaPicker: (MPMediaPickerController *) mediaPicker didPickMediaItems: (MPMediaItemCollection *) mediaItemCollection
{
if (mediaItemCollection)
{
NSArray *items = [mediaItemCollection items];
for( int n=0; n < items.count; n++ ) {
MPMediaItem *mediaItem = [items objectAtIndex:n];
NSLog(@"%@=========>",[mediaItem valueForProperty:MPMediaItemPropertyTitle]);
}
MPMusicPlayerController *musicPlayer = [MPMusicPlayerController iPodMusicPlayer];
[musicPlayer setQueueWithItemCollection: mediaItemCollection];
NSLog(@"==>%@",musicPlayer);
}
[self dismissViewControllerAnimated:YES completion:^(void) {}];
}
You're going to get all the songs in your library with this so the printout might take a while! Read up on MPMediaItem Class Reference and media queries to see how to get a subset of your entire music library.