From what I understand, AFNetworking can download any file. The problem here was on the Web Server settings, more specifically the Mime settings for .DWG files were missing.
AFNetworking not supporting DWG files?
-
01-06-2022 - |
Question
I have an In-house Ipad App that opens files that are stored elsewhere on the network through filters, menus, etc. The Main Formats for the Images are Tiff or PDF, so I convert them to a PDF (if TIFF) using a web-service. Users are asking to include DWG files and I downloaded a DWG viewer on the Ipad. I would like to use AFNetworking to download the DWG file from the server to the Ipad but it doesn't seem to work. The same code works great for PDF files:
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];
Thanks,
Shai
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow