2012-03-08 51 views
0

我通过ASIHTTP请求下载音频文件。当我并行下载三个或更少数量的文件时,其工作正常,但是当我尝试以并行方式下载更多第四个文件时,它会在项目中的所有tableView上显示活动指示符,并且不显示表数据? 这里是我的代码通过ASIHTTP请求并行下载文件的最大数量

UIProgressView *_progressBar = [[UIProgressView alloc] init]; 
    ASIHTTPRequest *request; 
    request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:trimmedString]]; 
    [request setDelegate:self]; 
    [request setDownloadDestinationPath:filePath]; 
    [request setDownloadProgressDelegate:_progressBar]; 
    [request setShowAccurateProgress:YES]; 
    [request setShouldContinueWhenAppEntersBackground:YES]; 
    [request setDidFinishSelector:@selector(downloadedSuccessfully:)]; 
    [request setDidFailSelector:@selector(downloadedFailure:)]; 
    [request startAsynchronous]; 

我没有那么在iPhone开发经验,所以随时提供帮助。 在此先感谢。

+0

给你的代码.. – Shubhank 2012-03-08 13:28:31

+0

请检查。 – 2012-03-08 13:34:38

回答

2

我想最好是使用ASINetworkQueue并执行ASIHTTPRequest将它作为一个操作添加到队列中。

ASINetworkQueue(如NSOperationQueue)具有maxConcurrentOperationCount属性。我使用超过5个并发操作,并且它们同时运行。