我有一个 iOS 应用程序,NSURLConnection
用于获取一些数据。当我从响应中打印标题时,这就是我所看到的:
"Content-Disposition" = "attachment;filename=test.txt.gz";
"Content-Encoding" = agzip;
"Content-Type" = "application/a-gzip";
Date = "Mon, 05 Nov 2012 22:18:23 GMT";
Server = "Apache-Coyote/1.1";
"Set-Cookie" = "JSESSIONID=3EBBF519202E16BEB1E79D12XXXXXXXXX; Path=/";
"Transfer-Encoding" = Identity;
filename = "test.txt.gz";
但是,当我尝试读取日志时,文本文件如下所示:
NSString *result = [[NSString alloc] initWithData:myData encoding:NSUTF8StringEncoding];
NSLog(@"%@",result);
我明白了null
。我知道数据在那里,因为当我记录它时它会吐出十六进制,并且我知道该调用有效,因为我已经在 RESTClient 中对其进行了测试。有什么想法吗?