I need to display a list of all of the playlists currently on the device. The problem is, on a device with iTunes Match turned on, any number of playlists could have zero items saved on the phone. Since (as far as I can tell) there's no reliable way to trigger an MPMediaItem download
when you're using AVAudioPlayer
, I'd like to filter out any playlists that don't have any local entries. Right now I can have it cycle through an individual playlist and strip songs that don't have an assetURL
, but this is waaaay too slow to do globally if the user has a lot of playlists. I tried filtering the entire music library to get playlists with
MPMediaQuery *songsQuery = [MPMediaQuery songsQuery];
[songsQuery addFilterPredicate:[MPMediaPropertyPredicate predicateWithValue:[NSNumber numberWithBool:NO] forProperty:MPMediaItemPropertyIsCloudItem]];
songsQuery.groupingType = MPMediaGroupingPlaylist;
However, when I cycle through the "collections" array it doesn't appear to filter any songs out at all. I'd try filtering by whether the song has an assetURL
, but of course you can't filter by that.
Does anyone have a reasonably fast way to pull this off? (Alternatively, has anyone figured out a decent way to trigger an MPMediaItem download
, since Apple has like no developer documentation on dealing with iTunes Match?)