NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:@"路径"]];
[request setHTTPMethod:@"GET"];
[request setTimeoutInterval:60.0f];
// 开启线程
NSOperationQueue *queue=[[NSOperationQueue alloc] init];
// 发送异步get请求,结果通过block返回
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
// 沙盒路径
NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"icon-integralCenter.png"];
// 写入沙盒
BOOL r = [data writeToFile:path atomically:YES];
if (r)
NSLog(@"保存图片成功");
}];