ASIHTTPRequest 緩存我的數據。我不想要任何類型的緩存 (ASIHTTPRequest caches my data. I don't want any kind of cache)


問題描述

ASIHTTPRequest 緩存我的數據。我不想要任何類型的緩存 (ASIHTTPRequest caches my data. I don't want any kind of cache)

I have a big app. It initially assumed 20 MB RAM. 

I want for example to download a 14 MB opera. After a few minutes I downloaded an opera. My application RAM increase from 20 to 34 MB. This is big problem because if I want to download 200 MB file my app will be killed.(14+200). I tried several times and I got "did received memory warning" and then app was killed. 

ASIHTTPRequest caches my data. I don't know why. I even removed all code from request: didReceiveData:. But It didn't helped me.

IMPORTANT: I created a new empty project and added this code. In this project everything works well. ASIHTTPRequest don't cache any data. May be I need to change XCode settings? 

-(void) downloadOpera
{
 self.currentPath = @"http://get-tsw-1.opera.com/pub/opera/mac/1164/Opera_11.64_Setup_Intel.dmg";
 self.ASIRequest = [[[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:currentPath]] autorelease];
 ASIRequest.delegate = self;
 ASIRequest.shouldContinueWhenAppEntersBackground = YES;
 [ASIRequest setCachePolicy:ASIDoNotWriteToCacheCachePolicy];
 [ASIRequest startAsynchronous];
}

- (void)request:(ASIHTTPRequest *)request didReceiveData:(NSData *)data {}
- (void)requestFailed:(ASIHTTPRequest *)request {}
- (void)requestFinished:(ASIHTTPRequest *)request {NSLog(@"download finished");}

參考解法

方法 1:

Turn off enable zombie objects and relax...

(by Voloda2Voloda2)

參考文件

  1. ASIHTTPRequest caches my data. I don't want any kind of cache (CC BY-SA 3.0/4.0)

#asihttprequest #caching #iOS






相關問題

遠程服務器上的請求總是失敗 (Request always fail on distant server)

ASIHTTPRequest 緩存我的數據。我不想要任何類型的緩存 (ASIHTTPRequest caches my data. I don't want any kind of cache)

在調用之前釋放了 didFinishSelector ASIHTTPRequest 的自定義委託類 (Custom delegate class for didFinishSelector ASIHTTPRequest being deallocated before called)

Android:在後台上傳/下載文件數量的最佳方式 (Android: best way to upload/download number of files in background)

Ghi giá trị bài đăng trong ASIFormDataRequest (Log Post Value in ASIFormDataRequest)

ASIHTTPRequest - 下載問題 (ASIHTTPRequest - download problem)

ASIHTTPRequest 離線模式連接失敗 (ASIHTTPRequest offline mode connection failure)

ASIHttpRequest 請求:didReceiveBytes:未按預期工作 (ASIHttpRequest request:didReceiveBytes: not working as expected)

如何讓 Ruby on Rails 與 ASIHTTPRequest 一起使用? (How do I get Ruby on Rails to work with ASIHTTPRequest?)

可以指定一個 NSObject 作為多個 ASIHTTPRequests 的代表嗎? (OK to assign one NSObject as the delegate of multiple ASIHTTPRequests?)

需要幫助將 NSXMLParser 與 ASIHTTPRequest 一起使用 (need help using NSXMLParser with ASIHTTPRequest)

處理 ASIHTTPRequest 多個請求 (Handling ASIHTTPRequest Multiple Requests)







留言討論