0

我一直在尝试使用 ASIHTTP 库触发多个下载请求。我可以开始第一个请求的下载...但是当我将另一个 ASIHTTPRequest 添加到队列中时,它没有下载..你能不能建议让下一个下载开始..

-(void)createNewDownloadRequestWithURL:(NSString *)videoURL andProgressIndicator:      (UIProgressView *)progressView andDelegate:(id)delegate
{
ASIHTTPRequest *request;
request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:videoURL]];
NSString * destFilePath = [[[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"Videos"] stringByAppendingPathComponent:[videoURL lastPathComponent]];
[request setDownloadDestinationPath:destFilePath];
[request setDownloadProgressDelegate:progressView];
[request setAllowResumeForFileDownloads:YES];
[request setTemporaryFileDownloadPath:[NSString stringWithFormat:@"%@.download",destFilePath]];
[request setUserInfo:[NSDictionary dictionaryWithObjectsAndKeys:[videoURL lastPathComponent],@"name",delegate,@"delegate",nil]];
request.delegate = self;
request.tag = VIDEO_DOWNLOAD_REQUEST;
[networkQueue addOperation:request];

if(!isDownloadOn)
    [networkQueue go];
isDownloadOn = YES;
}
4

1 回答 1

0

做这个:

[networkQueue go];

代替:

if(!isDownloadOn)
    [networkQueue go];

isDownloadOn = YES;

[networkQueue go]您应该在添加下载请求时调用。

于 2012-04-11T04:39:23.100 回答