views:

383

answers:

1

I'm using some pretty standard URL code in Cocoa - basically

result = [NSURLConnection sendSynchronousRequest:query 
                               returningResponse:&response
                                           error:&serverError];

However I cannot see how to detect when the query (which is the URL) responds with a redirect - I want to be able to process the data differently if the result is not the HTML code that I expect due to a redirect - in which case I want to capture and parse the redirected URL

Can anyone help me with this?

+1  A: 

Do you have to use the synchronous version? You get a lot more control with the asynchronous version, including the redirect callback described in Apple's overview of NSURLConnection.

smorgan