I'm trying to replicate the iOS music app's audiobook functionality.
I want to query all audiobooks in the iPod library. It shouldn't show each individual part but should show each book. Tapping a book should then show the parts inside it.
I've tried using [MPMediaQuery audiobooksQuery];
but that just seems to fetch all individual parts.
I've also tried:
MPMediaPropertyPredicate *abPredicate =
[MPMediaPropertyPredicate predicateWithValue:[NSNumber numberWithInt:MPMediaTypeAudioBook]
forProperty:MPMediaItemPropertyMediaType];
MPMediaQuery *abQuery = [[MPMediaQuery alloc] init];
[abQuery addFilterPredicate:abPredicate];
but that does the same thing.
This is my code
MPMediaQuery *everything = [[MPMediaQuery alloc] init];
MPMediaPropertyPredicate *predicate = [MPMediaPropertyPredicate predicateWithValue: [NSNumber numberWithInteger:MPMediaTypeAudioBook] forProperty:MPMediaItemPropertyMediaType];
[everything addFilterPredicate: predicate];
[everything setGroupingType: MPMediaGroupingAlbum];