Reputation: 4202
I was tasked to create a music player application that is sort of like a DJ app, and when the add music button is clicked, it needs to show the list of all the songs just like the native MediaPickerController
but with added functionalities like sorting, search and not fullscreen which is not available in the native one.
I tried scouring the internet for an answer but I can't find anything about this, it's all about creating the native media picker controller.
I found about MPMediaQuery which allows you to get the songs list in the phone, but I can't use it in a for-in
Sample:
MPMediaQuery *songs = [MPMediaQuery songsQuery];
for (MPMediaItem *item in songs) {
}
But I get this:
*Collection expression type 'MPMediaQuery ' may not respond to 'countByEnumeratingWithState:objects:count:'
Any suggestions?
Upvotes: 0
Views: 175
Reputation:
About the mediaquery, you need to convert it to nsarray first, try this:
MPMediaQuery *songs = [MPMediaQuery songsQuery];
NSArray *songList = [songs items];
for (MPMediaItem *item in songList) {
}
Upvotes: 1