How to check if ipod has music files
-
26-09-2019 - |
Question
I am trying to have my app play music from ipod using MPMusicPlayerController but there are devices which do not have music in there ipod library. Can anyone tell me if there is a way to check whether there is music in the ipod library or not before initializing the ipod player.
Thanks in advance.
Solution
if ([[[MPMediaQuery songsQuery] items] count] > 0) {
// The user has songs in his or her library.
}
OTHER TIPS
MPMediaQuery *query = [MPMediaQuery songsQuery]; NSArray *collections = [query collections];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow