Voloda2
Voloda2

Reputation: 12607

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");}

Upvotes: 1

Views: 345

Answers (1)

Voloda2
Voloda2

Reputation: 12607

Turn off enable zombie objects and relax...

Upvotes: 2

Related Questions