Reputation: 477
I'm sure there's a very easy explanation to this, but I'm tearing my hair out over the matter.
-(void)addRequestWithUrl:(NSURL *)url savePath:(NSString *)path
{
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
request.userInfo = [[NSMutableDictionary alloc] initWithObjectsAndKeys:path, @"savePath", nil];
networkQueue.showAccurateProgress = YES;
[self.networkQueue addOperation:request];
[self.networkQueue setDownloadProgressDelegate:self];
}
-(void)request:(ASIHTTPRequest *)request didReceiveBytes:(long long)bytes
{
DLog(@"bytes: %llu", bytes);
}
didReceiveBytes is not ever called. If I set the download progress delegate to each request instead of the queue the didReceiveBytes method is called, but only after each request is completely finished, and always with a value of 1.
Any suggestions what's wrong here? (working on iOS btw)
Upvotes: 2
Views: 2253
Reputation: 143
It may help:
[request setDidReceiveDataSelector:@selector(request:didReceiveBytes:)];
Upvotes: 4
Reputation: 331
Yeah it took me a while to figure this one out, I got the same result until I started to look into the ASIHTTPRequest code. All you have to do is add:
request.showAccurateProgress = YES;
before you networkQueue.showAccurateProgress = YES; because otherwise it does not read the individual head info of each file and add up the bytes.
Upvotes: 2