标签:
//扫描本地音乐文件,返回艺术家列表 需要库MediaPlayer.framework -(NSArray*) findArtistList { NSMutableArray *artistList = [[NSMutableArray alloc]init]; MPMediaQuery *listQuery = [MPMediaQuery playlistsQuery];//播放列表 NSArray *playlist = [listQuery collections];//播放列表数组 for (MPMediaPlaylist * list in playlist) { NSArray *songs = [list items];//歌曲数组 for (MPMediaItem *song in songs) { NSString *title =[song valueForProperty:MPMediaItemPropertyTitle];//歌曲名 //歌手名 NSString *artist =[[song valueForProperty:MPMediaItemPropertyArtist] uppercaseString]; if(artist!=nil&&![artistList containsObject:artist]){ [artistList addObject:artist]; } } } return artistList; }
标签:
原文地址:http://www.cnblogs.com/ZhangYuGe/p/4263195.html