问题
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