如何使用ASIHTTPRequest跟踪上传/下载进度 [英] How to Using ASIHTTPRequest to tracking Upload/Download progress

查看:195
本文介绍了如何使用ASIHTTPRequest跟踪上传/下载进度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些问题是使用ASIHTTPRequest跟踪上传/下载进度

I got some question is using ASIHTTPRequest to tracking Upload/Download progress

这是来自ASIHTTPRequest网站的样本

This is the sample from ASIHTTPRequest website

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDownloadProgressDelegate:myProgressIndicator];
[request startSynchronous];
NSLog(@"Max: %f, Value: %f", [myProgressIndicator maxValue],[myProgressIndicator doubleValue]

它说: myProgressIndicator 是一个NSProgressIndicator。

It says :myProgressIndicator is an NSProgressIndicator.

但看起来苹果已弃用 NSProgressIndicator

Check Here

那么......我怎么知道上传/下载进展???

So ... how can I know the Upload/Download progress ???

另一个问题是......如果上传/下载在任务完成之前终止

Also another question is ...if the Upload/Download was terminated before the task finish

如何让上传/下载任务从停止点(断点?)开始继续?

How can I let the Upload/Download task continues start from the stop point(break point?) ?

非常感谢〜

推荐答案

正如文档所述,代理也可以是iphone / ipad的UIProgressView:

As the documentation says, the delegate can also be an UIProgressView in case of iphone/ipad:

每个ASIHTTPRequest都有两个代表
,可用于跟踪进度
- downloadProgressDelegate(用于下载)和uploadProgressDelegate
(用于上传)。

Each ASIHTTPRequest has two delegates that can be used for tracking progress - downloadProgressDelegate (for downloads) and uploadProgressDelegate (for uploads).

进度代表可以是
NSProgressIndicators (Mac OS X)或
UIProgressViews (iPhone)。
ASIHTTPRequest将自动
以满足这两个类的
行为的差异。如果你想要
,你也可以使用自定义类
作为进度委托,只要
响应setProgress:。

Progress delegates can be NSProgressIndicators (Mac OS X) or UIProgressViews (iPhone). ASIHTTPRequest will automatically cater for the differences in the behaviour of these two classes. If you want, you can also use a custom class as a progress delegate, as long as it responds to setProgress:.


  • 如果您要执行单个
    请求,请在该
    请求上设置上传和/或
    下载进度委托

  • 如果您在队列中执行多个
    请求,并且您希望
    跟踪队列中所有
    请求的总体进度,请使用
    ASINetworkQueue并设置进度
    队列代表

  • 如果您想要
    同时执行这两项操作,
    也可以这样做(截至v0.97) )

来源:http://allseeing-i.com/ASIHTTPRequest/How-to-use#tracking_progress

这篇关于如何使用ASIHTTPRequest跟踪上传/下载进度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆