iOS NSURLSession DownloadTask(下载任务)
1. 不需要获取文件下载进度的方法 // 此方法无法获取到文件的下载进度,只能在结束时做响应 - (void)download { NSURL *url = [NSURL URLWithString:@"http://127.0.0.1/HBuilder.zip"]; [[[NSURLSession sharedSession] downloadTaskWithURL:url completionHandler:^(NSURL * _Nullable location, NSURLResponse * _Nullable response, NSError * _Nullable error) { // 当前线程, 子线程 NSLog(@"%@", [NSThread currentThread]); // 当前文件位置,临时文件,下载完成后删除临时文件 NSLog(@"%@",location); // 将文件复制到自己想要的位置 // 存放文件的路径 NSString *doc = [[NSSearchPathForDirectoriesInDomains(NSDocumentDi...