Instance Property


A dictionary of additional headers to send with requests.


@property(copy) NSDictionary *HTTPAdditionalHeaders;


This property specifies additional headers that are added to all tasks within sessions based on this configuration. For example, you might set the User-Agent header so that it is automatically included in every request your app makes through sessions based on this configuration.

An NSURLSession object is designed to handle various aspects of the HTTP protocol for you. As a result, you should not modify the following headers:

  • Authorization

  • Connection

  • Host

  • Proxy-Authenticate

  • Proxy-Authorization

  • WWW-Authenticate

Additionally, if the length of your upload body data can be determined automatically—for example, if you provide the body content with an NSData object—the value of Content-Length is set for you.

If the same header appears in both this array and the request object (where applicable), the request object’s value takes precedence.

The default value is an empty array.

See Also

Setting General Properties


The background session identifier of the configuration object.


The type of network service for all tasks within sessions based on this configuration.


A Boolean value that determines whether connections should be made over a cellular network.


The timeout interval to use when waiting for additional data.


The maximum amount of time that a resource request should be allowed to take.


The identifier for the shared container into which files in background URL sessions should be downloaded.


A Boolean value that indicates whether the session should wait for connectivity to become available, or fail immediately.