Mehul Mistri
Mehul Mistri

Reputation: 15147

How to check for number of requests completed in ASINetworkQueue

Is it possible to know how many requests finished in ASINetworkQueue?

Question is very straight forward.. Please see below example..

Example

Suppose there are number of ASIHttpRequests in ASINetworkQueue and if all requests are running and in between I am cancelling all operations in ASINetworkQueue then how do I know that how many requests are finished before cancel ?

Please help me to solve this question or just tell me that it is possible or not to count this?

Thanks in advance..

Upvotes: 0

Views: 647

Answers (2)

Muhammad Noman
Muhammad Noman

Reputation: 128

If you are using NSOperationQueue then following code can be used for getting count and to cancel all operations (requests) in the queue.

    if([self.serviceQueue operationCount])
    {
        [self.serviceQueue cancelAllOperations];
        self.serviceQueue = nil;
    }

Its a very old thread but I am posting for future considerations. Please let me know if any one is facing any other issue.

Upvotes: 1

HarshIT
HarshIT

Reputation: 4915

Let networkQueue be the object of your networkQueue. You may use

[networkQueue requestsCount];

It returns the number of operations pending in Network queue and on completion of each operations it subtracts the requestCount property. Thus by subtracting it From total requests you added in network queue , you may get the number of completed requests of networkQueue

Upvotes: 1

Related Questions