这是使用ASIHTTPRequest下载文件的正确方法吗? [英] Is this the correct way of downloading a file with ASIHTTPRequest?

查看:82
本文介绍了这是使用ASIHTTPRequest下载文件的正确方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是使用ASIHTTPRequest下载文件的正确方法吗?如您所见,我正在尝试将文件下载到文档目录并命名为Test.mov。唯一的部分是......文件没有下载。我仍然对ASIHTTPRequest如何工作感到困惑,所以感谢所有帮助!

Is this the correct way of downloading a file with ASIHTTPRequest? As you can see, I'm trying to download the file to the documents directory and am naming Test.mov. The only part is... the file doesn't download. I'm still confused by how ASIHTTPRequest works, so all help is appreciated!

-(IBAction)download {

    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"https://www.chillysky.com/Test.mov"]];

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *file = [NSString stringWithFormat:@"%@/Test.mov", documentsDirectory];

    [request setDownloadDestinationPath:file];
    [request setDownloadProgressDelegate:myProgressIndicator];
    [request setDelegate:self];

    NSLog(@"Downloading File");

}


推荐答案

搞定了!忘记这段代码:

Got it! Forgot this code:

[request startAsynchronous];

这篇关于这是使用ASIHTTPRequest下载文件的正确方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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