2011-12-13 185 views
0

我想解壓縮一些數據,即時得到它正在與zlib的壓縮,但即時得到在我的代碼一個警告,我不知道如何改正。ASIHTTPRequest的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' 

任何幫助,將不勝感激

回答

1

的問題是,你調用一個方法,zlibInflate,對象不支持該方法上:NSData表示一些任意數據,並且不知道任何關於解壓縮數據的內容。

你確定你想嘗試縮小你回來反正這些數據? ASIHTTPRequest不爲你處理膨脹(如果服務器返回了gzip的數據)?

,如果你只是對待NSData你回來,就好像它已經被誇大,會發生什麼?

也看到changelog,特別是部分題爲「在即時的gzip解壓縮」。

+0

是的,我想我只是要去gzip,因爲我沒有在zlib的東西進展。我只是在沒有處理數據的情況下找回一堆數字。 – 2011-12-13 23:04:02