MPMediaQuery *myPlaylistsQuery = [MPMediaQuery songsQuery];
NSArray *playlists = [myPlaylistsQuery collections];
for (MPMediaPlaylist *playlist in playlists) {
NSArray *songs = [playlist items];
for (MPMediaItem *song in songs)
{
Song *song1 = [[Song alloc] init];
song1.songName = [song valueForProperty: MPMediaItemPropertyTitle];
song1.singerName = [song valueForKey:MPMediaItemPropertyPodcastTitle];
[self.mySongArray addObject:song1];
//NSLog(@"song1.songName====%@",song1.songName);
[song1 release];
}
}
摘自 雲懷空-abel