2012-04-11 11 views
0

私はASIHTTPライブラリを使用して複数のダウンロード要求を発射しようとしています。 ...できますが、次のダウンロードが開始させるために、とにかくお勧めplzは..私は第一の要求のためのダウンロードを開始することができています...しかし、私はキューに別のASIHTTPRequestを追加するとき、そのは、ダウンロードしない実行中のASINetworkQueueに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; 
} 

答えて

0

ドゥこの:

[networkQueue go]; 

の代わり:あなたがダウンロード要求を追加するとき

if(!isDownloadOn) 
    [networkQueue go]; 

isDownloadOn = YES; 

あなたは[networkQueue go]呼び出す必要があります。

+0

私は以前同じことをやった...しかし、私のダウンロードの非は...リクエストを追加するための http://allseeing-i.com/ASIHTTPRequest/How-to-use 検索...意志にを開始書き込まれたnetworkQueueが何度も何度も呼び出す必要がないノート –

関連する問題