i wonder how can you update your NSURL to the last url that a your url will redirect to
using NSURL or NSRequest
appreciate your help. thanks.
zanque's solution works, but in order to avoid downloading "useless" data, I'd change the http method to HEAD :
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:orinigalURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
[request setHTTPMethod:@"HEAD"];
NSURLResponse *response = nil;
[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil];
NSURL *finalURL = response.URL;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With