你能跟踪ASIFormDataRequest的下载进度吗?

时间:2020-12-27 02:26:28

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

我在跟踪ASIFormDataRequest的下载进度时遇到问题。我可以很容易地获得上传进度但不能下载。

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

在ASIHTTPRequest站点的示例中,他们使用ASIHTTPRequest来显示下载进度。

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.

那么有可能获得ASIFormDataRequest的下载进度吗?我已经检查过我是否从服务器获得了Content-Length响应,不知道我还有什么问题。

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];

1 个解决方案

#1


1  

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

ASIFormDataRequest下载进度的问题在于我没有考虑服务器处理请求的时间。

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.

当ASIFormDataRequest到达服务器时,它会等待服务器响应数据。如果您必须等待服务器执行某种计算,这段时间可能需要一些时间。

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.

在我的情况下,上传速度和下载速度都非常快,因此无法看到进度,总是0到100%。唯一让我困惑的唯一过程是服务器执行的计算过程,在我的情况下是不确定的。

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

总之,一切都运作良好,除了我的理解......它一直在发生:-)

#1


1  

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

ASIFormDataRequest下载进度的问题在于我没有考虑服务器处理请求的时间。

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.

当ASIFormDataRequest到达服务器时,它会等待服务器响应数据。如果您必须等待服务器执行某种计算,这段时间可能需要一些时间。

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.

在我的情况下,上传速度和下载速度都非常快,因此无法看到进度,总是0到100%。唯一让我困惑的唯一过程是服务器执行的计算过程,在我的情况下是不确定的。

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

总之,一切都运作良好,除了我的理解......它一直在发生:-)