cancel a ASIHTTPRequest thread

Posted by user262325 on Stack Overflow See other posts from Stack Overflow or by user262325
Published on 2010-03-22T03:13:03Z Indexed on 2010/03/22 3:21 UTC
Read the original article Hit count: 568

Filed under:

Hello evryone

I have some codes to use ASINetworkQueue as multi thread download

ASINetworkQueue *networkQueue;
[networkQueue  setDelegate:self];
[networkQueue   setRequestDidFinishSelector:@selector(requestDone:)];
[networkQueue setShowAccurateProgress:true];

NSURL *url = [NSURL URLWithString:s];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];



[request setDownloadProgressDelegate:a];
[request setTag:index];
[request setTimeOutSeconds:10];
[request setDelegate:self];


[networkQueue  addOperation:request];

[networkQueue  go];

if I try to use the code below to cancel the thread with index k [[[networkQueue operations] objectAtIndex:k] cancel];

I notice all requests in ASINetworkQueue were cancelled and stop working.

Welcome any comment

Thanks

interdev

© Stack Overflow or respective owner

Related posts about iphone