同题。急!!!
@noear 人家都看不懂你的问题.
How to get the redirected url?
Hi @noear,
When you get redirected, you can get the original URL from the response.request
and the redirected URL from the response.response
.
let redirectURLString = "https://www.apple.com/"
let urlString = "https://httpbin.org/redirect-to?url=\(redirectURLString)"
Alamofire.request(urlString).response { response in
let originalURL = response.request?.url
let redirectURL = response.response?.url
}
Hopefully that helps answer your question. If Google Translate utterly failed me and I didn't answer your question, please translate into English so we can better understand.
Cheers. 🍻
真是太简单的;很酷!!!
Most helpful comment
Hi @noear,
When you get redirected, you can get the original URL from the
response.request
and the redirected URL from theresponse.response
.Hopefully that helps answer your question. If Google Translate utterly failed me and I didn't answer your question, please translate into English so we can better understand.
Cheers. 🍻