views:

24

answers:

2

Hi All,

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.

A: 

MPMediaQuery *query = [MPMediaQuery songsQuery]; NSArray *collections = [query collections];

Aaron Saunders
+2  A: 
if ([[[MPMediaQuery songsQuery] items] count] > 0) {
    // The user has songs in his or her library.
}
Robot K
Thank you for the reply it worked
Ankur