NSURLSession sharedSession default timeout

There are two timeouts for URL sessions. The first is the maximum time allowed between receiving new data. This is called the timeoutIntervalForRequest. The second is the maximum time the entire request is allowed to take (assuming it's regularly receiving new data). This is called the timeoutIntervalForResource.

Both of these timeouts are configured by default using NSURLSessionConfiguration, and can be overridden on the NSURLRequest.

The default timeoutIntervalForRequest is 60 seconds.

The default timeoutIntervalForResource is 7 days.


There are three timeout URL sessions now. Following are the details:

  1. timeoutInterval - The connection timeout is the timeout in making the initial connection i.e. completing the TCP connection handshake. If during a connection attempt the request remains idle for longer than the timeout interval, the request is considered to have timed out. The default timeout interval is 60 seconds.

  2. timeoutIntervalForRequest - The timeout interval to use when waiting for additional data to arrive before giving up. This value is reset once new data arrive. The default value is 60.

  3. timeoutIntervalForResource - Any upload or download tasks created by a background session are automatically retried if the original request fails due to a timeout. To configure how long an upload or download task should be allowed to be retried or transferred, use the timeoutIntervalForResource property. The default value is 7 days.

Refer apple documentation for more details: timeoutInterval, timeoutIntervalForRequest and timeoutIntervalForResource