Cyprian
Cyprian

Reputation: 9453

Can you track download progress on ASIFormDataRequest?

I am having a problem tracking the download progress for ASIFormDataRequest. I can easily get the upload progress but not the download.

In the example on the ASIHTTPRequest site they use ASIHTTPRequest to show download progress.

So is it possible to get the download progress for the ASIFormDataRequest? I already checked if I get the Content-Length response from the server, dunno what else I am doing wrong.

My setup.

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
request.downloadProgressDelegate = progressIndicator;
[request setShouldAttemptPersistentConnection:NO];

[self performSelectorOnMainThread:@selector(showProgress:) withObject:[NSNumber numberWithInt:0] waitUntilDone:NO];

[request startSynchronous];

Upvotes: 0

Views: 354

Answers (1)

Cyprian
Cyprian

Reputation: 9453

The problem with the download progress for ASIFormDataRequest was that I didn't take into consideration the time server is processing the request.

When the ASIFormDataRequest reaches the server it waits until the server responds with the data. If you have to wait for server to perform some kind of calculation this period may take some time.

In my case the upload was super fast as well as the download, hence I could not see the progress, it was always 0 to 100%. The only process that was long and that got me confused was the calculation process the server was performing which in my case is undeterministic.

In short, all was working well, except my understanding... It happens all the time :-)

Upvotes: 1

Related Questions