Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You want to adjust various HTTP headers and settings of a URL request before passing it to a URL connection.
This technique is the basis of many useful recipes shown later
in this chapter. Use NSMutableURLRequest
instead of NSURLRequest.
A URL request can be either mutable or immutable. A mutable URL request
can be changed after it has been allocated and initialized, whereas an
immutable URL request cannot. Mutable URL requests are the target of
this recipe. You can create them using the NSMutableURLRequest class.
Let’s have a look at an example where we will change the timeout interval of a URL request after we have allocated and initialized it: