Can someone please post the simplest of working code that can get the last redirected url(nth) when I GET request a url?
I know I need to use asynchronous requests but
Please read Handling Redirects and Other Request Changes in the documentation. Briefly, you'll want to a) provide a delegate for your connection, and b) implement the method connection:willSendRequest:redirectResponse:
in said delegate. I don't understand exactly what you're trying to do in your question -- do you just want the data from URL to which your connection is redirected, or do you want to see the redirected request? Either way, implementing the method above should help. Your delegate will be able to see the redirected request, and returning it unchanged should cause the connection to load the new URL.