http://potter528.bj.bdysite.com
self.playlist为播放数组
MusicInfo is Model
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//每次调用该获取接口内容的方法,先清除播放列表中的旧数据
[self.playlist removeAllObjects];
NSArray *temparr = [NSArray arrayWithContentsOfURL:[NSURL URLWithString:kPlaylistURL]];
for (NSDictionary *dic in temparr) {
//创建Music对象
MusicInfo *music = [MusicInfo new];
[music setValuesForKeysWithDictionary:dic];
[self.playlist addObject:music];
}
dispatch_async(dispatch_get_main_queue(), ^{
//在主线程进行操作
handler();
});
});
网友评论