iPhone NSURL get last redirected url

前端 未结 4 1116
轮回少年
轮回少年 2021-01-01 03:01

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.

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-01 03:03

    You'll only be able to find this out after trying to connect using NSURLConnection. If you add a method to your NSURLConnection delegate, -connection:willSendRequest:redirectResponse:, you'll be notified before redirects happen. Just grab the URL from the passed request, and that's your answer.

提交回复
热议问题