我试图解压缩一些我正在使用zlib压缩的数据,但我在代码中收到警告,我不知道如何纠正。
- (void)requestFinished:(ASIHTTPRequest *)request
{
responseData = [request responseData]; //Pass compressed data from server over to NSData variable might use to check size
NSData *uncompressedResponseData = [[NSData alloc] init];
uncompressedResponseData = [[request responseData] zlibInflate]; //error here
//Is this where I have to think about decompression? or do I pass this data out to another method?
}
错误读为
Receiver type 'NSData' for instance message dose not declare a method with selector 'zlibInflate'
任何帮助将不胜感激
答案 0 :(得分:1)
问题是你在一个不支持该方法的对象上调用方法zlibInflate
:NSData
表示一些任意数据,并且对解压缩数据一无所知
您确定要尝试缩小您收到的数据吗? ASIHTTPRequest不会为您处理膨胀(如果服务器返回了gzip数据)?
如果您只是将NSData
的回复视为已经被夸大了会怎么样?
另请参阅changelog,特别是标题为“动态gzip解压缩”的部分。