this is the code i use to cancel the download.
NSArray *queueArray = [downloadQueue operations];
for (ASIHTTPRequest *request in queueArray) {
NSString *objid = [request.userInfo objectForKey:Column_objectid];
if ([objid isEqualToString:audioToDelete.objectId]) {
[request clearDelegatesAndCancel];
[request removeTemporaryDownloadFile];
...}}
but after i call
[request clearDelegatesAndCancel]
downloadQueue.operations or downloadQueue.requestsCount is still the same count (downloadQueue is my ASINetworkQueue)
how can i remove it from the queue ? or how can i get the correct operation count of my downloadQueue?
Do this:
NSArray *queueArray = [downloadQueue operations];
for (ASIHTTPRequest *request in queueArray) {
NSString *objid = [request.userInfo objectForKey:Column_objectid];
if ([objid isEqualToString:audioToDelete.objectId]) {
[request cancel];
}
}