http://potter528.bj.bdysite.com
self.playlist為播放數(shù)組
MusicInfo is Model
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//每次調(diào)用該獲取接口內(nèi)容的方法,先清除播放列表中的舊數(shù)據(jù)
[self.playlist removeAllObjects];
NSArray *temparr = [NSArray arrayWithContentsOfURL:[NSURL URLWithString:kPlaylistURL]];
for (NSDictionary *dic in temparr) {
//創(chuàng)建Music對(duì)象
MusicInfo *music = [MusicInfo new];
[music setValuesForKeysWithDictionary:dic];
[self.playlist addObject:music];
}
dispatch_async(dispatch_get_main_queue(), ^{
//在主線程進(jìn)行操作
handler();
});
});