My app loads a music playlist automatically when it starts up. In order to do this, I store the song IDs MPMediaItemPropertyPersistentID
to a database, and load the songs when the app is starting up next time. The main code is the following:
MPMediaQuery *MPMediaSongQuery = [MPMediaQuery songsQuery];
MPMediaPropertyPredicate *iPodMusicSongPredicateiPodMusicSongPredicate = [MPMediaPropertyPredicate
predicateWithValue:[NSNumber numberWithUnsignedLongLong: songID]
forProperty:MPMediaItemPropertyPersistentID
comparisonType:MPMediaPredicateComparisonEqualTo];
[MPMediaSongQuery addFilterPredicate:iPodMusicSongPredicate];
NSArray *collections = MPMediaSongQuery.collections;
The code loads song one by one. My question is: is there any way to query two or more songs by MPMediaItemPropertyPersistentID
at one time when using the function addFilterPredicate:
? Thanks.