ASIHTTPRequest發送異步請求方法之一

来源:互联网 发布:主机是数据终端设备吗 编辑:程序博客网 时间:2024/04/29 12:18

下載ASIHTTPRequest
加入Framework: CFNetwork.framework,SystemConfiguration.framework,MobileCoreServices.framework
__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:sourceURL];
[request setCompletionBlock:^{
    NSLog(@"Zip file downloaded.");
    NSData *data = [request responseData];
    [self processZip:data sourceURL:sourceURL];        
}];
[request setFailedBlock:^{
    NSError *error = [request error];
    NSLog(@"Error downloading zip file: %@", error.localizedDescription);
}];
[request startAsynchronous]; 

原创粉丝点击