I want to add operation into executing request. I read about ASINetworkQueue, but it adds all operation and run it all. but i want to add operation into running queue.
Is this possible? using ASIHTTPRequest or AFNetworking i don't mind, as long as i get what i intend to do.
It shows below error while i try to add another request.
[ASINetworkQueue addOperation:]: operation is executing and cannot be enqueued'
From the apple documentation for addOperation:
it is clear that you cannot add an operation which is executing into a NSOperationQueue
.
This is what mentioned there,
An operation object can be in at most one operation queue at a time and this method throws an NSInvalidArgumentException exception if the operation is already in another queue. Similarly, this method throws an NSInvalidArgumentException exception if the operation is currently executing or has already finished executing.
That is the default behavior of NSOperationQueue
. You need to make sure that the NSOperation
is not executing before adding to queue. There are various properties such as isExecuting
, isFinished
etc.. to check this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With