iOS Swift3.0 获取重定向之后的url
作者:
梁同桌 | 来源:发表于
2017-01-16 13:27 被阅读155次let req = URLRequest(url: URL(string: "http://cn-gdfs16-dx.acgvideo.com/vg19/8/8f/13083625-1-hd.mp4?expires=1484548200&ssig=SleYiSWduQ5N8YF00vZXEQ&oi=1917006008&nfa=zewukGbkdeYAV6tVxJRokA==&dynamic=1")!)
let connection = NSURLConnection(request: req, delegate: self)
connection?.start()
//代理方法:NSURLConnectionDataDelegate
func connection(_ connection: NSURLConnection, willSend request: URLRequest, redirectResponse response: URLResponse?) -> URLRequest? {
print(request.url!)//这里打印重定向之后的地址
return request
}
本文标题:iOS Swift3.0 获取重定向之后的url
本文链接:https://www.haomeiwen.com/subject/psfpbttx.html
网友评论