3

I need to filter my query items by .mp3 files. Now i am getting result from query,it's contains video files(mp4). these are my line of codes

 MPMediaQuery *everything = [[MPMediaQuery alloc] init];
        NSArray *itemsFromGenericQuery = [everything items];
        self.songs = [NSMutableArray arrayWithArray:itemsFromGenericQuery];
rmaddy
  • 314,917
  • 42
  • 532
  • 579
abymathew
  • 115
  • 1
  • 1
  • 11

1 Answers1

0

To get all the songs in the library use -[MPMediaQuery songsQuery] instead of creating your own MPMediaQuery.

If you're looking for local .mp3 files specifically, you add a filter for the property MPMediaItemPropertyIsCloudItem, and then check -[MPMediaItem assetURL] to determine if the file matches.

Clark
  • 36
  • 3