I'm building a client for a server with (apparently) weird redirect
I cannot get a proper HTTP response using NSURLConnection
However, I can print out the response code using the asynchronous
[[NSURLConnection alloc] initWithRequest:request delegate:self];
When I swap this method in, I can print out the status code just fine.
However, because this approach is asynchronous my code calls this
moves on without waiting for a return value. I need the request to
before moving on.
How can I force my code to wait for the asynchronous request to
without using sendSynchronousRequest?
You can split your post-connection stuff into another method, and call
it from the delegate's implementation of connectionDidFinishLoading:.
Then it will be called only when the connection is complete.