HTTP requests made using NSURLConnection
are event driven. This makes things a little strange when you need to issue three requests one after another, where each request uses the information returned from the previous one.
I'm used to doing it like this:
response1 = request1(); response2 = request2(response1); response3 = request3(response2);
But the only way to find a way to do this with NSURLConnection
is to make connectionDidFinishLoading:
make the following request. But when the number of consecutive requests grows, it can become messy.
What is the idiomatic way to handle consecutive HTTP requests with cocoa?
pepsi source share