ASIHTTP: addOperation when other threads are running

Posted by user262325 on Stack Overflow See other posts from Stack Overflow or by user262325
Published on 2010-03-12T04:59:43Z Indexed on 2010/03/12 5:07 UTC
Read the original article Hit count: 362

Filed under:

Hello everyone

I have a project using ASIHTTP to multi download files from a site

when I add a new request:

[networkQueue cancelAllOperations];
[networkQueue  setDownloadProgressDelegate:a];
[networkQueue  setDelegate:self];
[networkQueue   setRequestDidFinishSelector:@selector(requestDone:)];

NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDelegate:self];
[request startAsynchronous];
[networkQueue  addOperation:request];

[networkQueue  go];

it reported:

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[ASINetworkQueue addOperation:]: operation is executing and cannot be enqueued'

It looks like I can not add a new request when others are running.

Welcome any comment

Thanks

interdev

© Stack Overflow or respective owner

Related posts about iphone