// 原代码块一
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// 原代码块二
NSURL * url = [NSURLURLWithString:@"http://www.youdao.com"];
NSError * error;
NSString * data = [NSStringstringWithContentsOfURL:url encoding:NSUTF8StringEncodingerror:&error];
if (data != nil) {
// 原代码块三
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"下载完成 %@",data);
});
} else {
NSLog(@"error when download:%@", error);
}
});