Can I copy NSURLRequest and reuse it?

I am using api with oauth2 and you need to update the access token when it expires. Therefore, I want to resubmit the request after updating the request. I mean, will NSURLConnection change the http request object. Thanks in advance!

+4
source share
1 answer

Have you checked the URL loading guide ? He has this in a field in the text:

When a client application initiates a connection or loads using an instance of NSMutableURLRequest, a deep copy is made from the request. Changes made to the initiating request have no effect after the download is initialized.

Thus, you can reuse your request as much as you want without fear of change. NSURLConnection works with copy.

+7
source

All Articles