0
我有一个内部Ipad应用程序,打开通过过滤器,菜单等存储在网络其他地方的文件。 图像的主要格式是Tiff或PDF,所以我将它们转换为PDF(如果TIFF)使用网络服务。 用户要求包含DWG文件,并在Ipad上下载了DWG查看器。我想使用AFNetworking将DWG文件从服务器下载到Ipad,但似乎不起作用。 相同的代码的PDF文件的伟大工程:AFNetworking不支持DWG文件?
urlString = [urlString stringByAppendingString:strFile];
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *req = [NSURLRequest requestWithURL:url];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]
initWithRequest:req];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *outputPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:strFile];
operation.outputStream = [NSOutputStream outputStreamToFileAtPath:outputPath append:NO];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"Successfully downloaded file to %@", outputPath);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
[operation start];
感谢,
夏嘉曦