【问题标题】:AFNetworking not supporting DWG files?AFNetworking 不支持 DWG 文件?
【发布时间】:2013-06-25 18:16:45
【问题描述】:

我有一个内部 Ipad 应用程序,它通过过滤器、菜单等打开存储在网络上其他地方的文件。 图像的主要格式是 Tiff 或 PDF,所以我使用网络服务将它们转换为 PDF(如果是 TIFF)。 用户要求包含 DWG 文件,我在 Ipad 上下载了 DWG 查看器。我想使用 AFNetworking 将 DWG 文件从服务器下载到 Ipad,但它似乎不起作用。 相同的代码适用于 PDF 文件:

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];

谢谢,

【问题讨论】:

    标签: ipad afnetworking nsurlrequest dwg


    【解决方案1】:

    据我了解,AFNetworking 可以下载任何文件。这里的问题在于 Web 服务器设置,更具体地说,.DWG 文件的 Mime 设置丢失了。

    【讨论】:

      猜你喜欢
      • 2014-05-10
      • 1970-01-01
      • 1970-01-01
      • 2011-12-09
      • 2013-10-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-21
      相关资源
      最近更新 更多