How to use ios 5 sdk’s asynchronous http get requests to handle redirected urls?
I have found the knowledge in bits and pieces. All the solutions assume some important piece of info to be known to the user. This is very difficult to figure out for a person who who has just started coding ios that to beginning with ios5 sdk.
I know a lot of people might ask to go and read the doc, which somehow have the same issue but please, could someone explain the concept in simple terms…a working code along with the little detail what peice goes where?
Thanks for your time!
AFNetworking provides a good foundation of code for dealing with network requests, and this page specifically has information regarding redirects. It doesn’t look like the changes proposed in that comment thread have been committed yet but in any case check it out and see if that helps.
In short, kcharwood suggests subclassing the whichever operation you choose to use and overriding
-(NSURLRequest *)connection:willSendRequest:redirectResponse:like so: