Is this the correct way of downloading a file with ASIHTTPRequest?

瘦欲@ 提交于 2019-12-10 11:57:31

问题


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

}

回答1:


Got it! Forgot this code:

[request startAsynchronous];


来源:https://stackoverflow.com/questions/8116555/is-this-the-correct-way-of-downloading-a-file-with-asihttprequest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!