I am using ASIHTTPRequest to download some data.
I have the following in a method:
// Request 1
request1.tag = 1;
[request1 setDelegate:self];
[request startAsynchronous];
// Request 2
request2.tag = 2;
[request2 setDelegate:self];
[request2 startAsynchronous];
// Call third request method
[self callThirdRequest];
Now from within callThirdRequest
, I am grabbing some data that has been downloaded from request2
and in there, I am calling startAsynchronous
. The reason I have the calling of the third request in a separate method is because it will get invoked more than once. After putting some console outputs, it seems that callThirdRequest
is being invoked before request2
starts its download. Therefore, when callThirdRequest
tries to grab some data which should have been downloaded by request2
, it does not work as there is no data.
Why is that? How can I make sure callThirdRequest
is only called when request2
is done downloading?
Thanks,