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.
You cause following swift code to get the final redirected url:
let request = NSMutableURLRequest(url: url, cachePolicy: .reloadIgnoringCacheData, timeoutInterval: 15.0)
request.httpMethod = "HEAD"
var response: URLResponse? = nil
do {
try NSURLConnection.sendSynchronousRequest(request as URLRequest, returning: &response)
} catch { //Handle exception //if any
}
let finalURL = response?.url