1. 主队列中的任务就是在主线程执行
dispatch_sync(dispatch_get_main_queue(), ^{
[NSThread sleepForTimeInterval:1.0];//让主线程睡一秒
NSLog(@"更新UI = %@",[NSThread currentThread]);
});
2.异步
dispatch_async(dispatch_get_global_queue(0, 0), ^{
NSLog(@"下载任务 = %@",[NSThread currentThread]);
});