Search code examples
progress-barasihttprequest

setDownloadProgressDelegate of ASIHTTPRequest not working


I want to download a large size zip file from a server. To do this, I am using ASIHTTPRequest. I have successfully downloaded the file, but I want to show a progress bar. I have implemented it just like the example of ASIHTTPRequest, but my progress bar is not showing progress. My code is below:

  [networkQueue reset];
  networkQueue setRequestDidFinishSelector:@selector(imageFetchComplete:)];
[networkQueue setRequestDidFailSelector:@selector(imageFetchFailed:)];
    [networkQueue setDelegate:self];
    request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:fullURL]];
    fullPathTemp = [NSString stringWithFormat:@"%@/temp.zip", self.documentsDir];
    [request setDownloadProgressDelegate:progressIndicator];
    [request setDownloadDestinationPath:fullPathTemp];
    [request setUserInfo:[NSDictionary dictionaryWithObject:@"request1" forKey:@"name"]];
    [request setShouldContinueWhenAppEntersBackground:YES];
    [networkQueue addOperation:request];
   [networkQueue go];

Solution

  • May be your progressIndicator is not set delegate.