我的实现的代码 :(原来如此简单)
NSString * path=[ NSSearchPathForDirectoriesInDomains (NSDocumentDirectory , NSUserDomainMask ,YES ) objectAtIndex :0 ];
path=[path stringByAppendingPathComponent :@"li.amr" ];
NSURL *url = [NSURL URLWithString :@"http://www.chihuo876.com/Public/Uploads/mobile/Vedio/51c1117f85337.amr" ];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL :url];
[request setDownloadDestinationPath :path];
[request startSynchronous ];
这几个是群里兄弟推荐的:http://www.cocoachina.com/bbs/read.php?tid=10072
http://blog.sina.com.cn/s/blog_86eee82e0101c86e.html
http://www.cnblogs.com/jjtech/archive/2011/04/17/2019210.html
转载自:http://blog.csdn.net/kmyhy/article/details/6524916
1、简单下载
打开IB,拖入一个Progress View,在源文件中声明为IBOutlet,然后进行连接。
-( IBAction )goURL{
NSString * path=[ NSSearchPathForDirectoriesInDomains ( NSDocumentDirectory ,NSUserDomainMask , YES ) objectAtIndex : 0 ];
path=[path stringByAppendingPathComponent : @"plsqldev714.rar" ];
NSURL *url = [ NSURL URLWithString : @"http://localhost/upload/plsqldev714.rar" ];
ASIHTTPRequest *request = [ ASIHTTPRequest requestWithURL :url];
[request setDownloadDestinationPath :path];
[request setDownloadProgressDelegate : progressView ];
[request startSynchronous ];
}
运行程序,下载进度会在progress view中显示。下载进度显示当前完成的大约比例。