ASIHTTPRequest を使用して複数のダウンロードを行っています。ここでは非同期ダウンロード方式を使用しているため、複数のダウンロードを実行できます。正常に動作しています。今、これらのダウンロード ファイルをアプリケーションのローカル フォルダー (デバイス内) に保存し、それを取得したい (各ファイルへのパスを取得したい)。これどうやってするの?ここでは複数のダウンロードが実行されているため、ダウンロード内の各ファイルをどのように区別できますか? これが私が使用したコードです。
- (void)download{
UIImageView *image = (UIImageView *)[mainView viewWithTag:selectedTag];
for (UIProgressView *currentProgress in [image subviews]) {
if ([currentProgress isKindOfClass:[UIProgressView class]]) {
NSLog(@"Prog tag: %d",currentProgress.tag);
if(currentProgress)
{
currentProgress.progress = 0.0;
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:[urlArray objectAtIndex:selectedTag]]];
[request setDownloadProgressDelegate:currentProgress];
[request setShowAccurateProgress:YES];
[request setDownloadDestinationPath:[[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"mansory_porsche_carrera_3-1920x1200.jpg"]];
[request shouldContinueWhenAppEntersBackground];
[request allowResumeForFileDownloads];
[request startAsynchronous];
}
}
}
}