这是使用ASIHTTPRequest下载文件的正确方法吗?

时间:2011-11-14 02:06:59

标签: iphone objective-c ios ipad asihttprequest

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

-(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");

}

1 个答案:

答案 0 :(得分:1)

知道了!忘了这段代码:

[request startAsynchronous];
相关问题