Connect and Complete timeouts for NSMutableURLRequest Connect and Complete timeouts for NSMutableURLRequest curl curl

Connect and Complete timeouts for NSMutableURLRequest


That's a really good question. The documentation on it was unclear to me:

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.

I did find this really helpful post in the Apple Developer Forums, which an Apple employee explains:

The timeoutInterval property is equivalent to timeoutIntervalForRequest property.

He's referencing the property on NSURLSessionConfiguration, which can be attached to an NSURLSession. If you set the timeoutInterval of an NSURLRequest, it is used as the value for timeoutIntervalForRequest on the configuration. This property's documentation does provide some insight:

The request timeout interval controls how long (in seconds) a task should wait for additional data to arrive before giving up. The timer associated with this value is reset whenever new data arrives. When the request timer reaches the specified interval without receiving any new data, it triggers a timeout.

The default value is 60.

Based on that, it seems this value is actually neither!