What is the situation with NSURLConnection timeout with iOS5?

I am trying to find a definitive answer if it is possible to set a timeout value for using NSURLConnection in iOS 5 (I would like to set it for 30 seconds).

I have looked for past posts about this, but the information seems contradictory. For example, this message

NSURLConnection timeout?

says Apple assigns a 4 minute minimum timeout, although I cannot find Apple documentation to support this.

This publication says that the 240-day limit comes from the thread of the apple forum NSMutableURLRequest does not obey my timeoutInterval

They say that this limit is only for POST when the body is not empty. Does this mean that for GETS you can set a timeout of less than 4 minutes?

Someone commented here that this is not the case with iOS 5, however they were voted NSMutableURLRequest does not obey my timeoutInterval

And there others say other things, but in any case, most of the previous publications on this topic seem to be from a couple of years ago to iOS 5.

If there is a 4-minute limit, you need to rely on rumors to know that this is a little ridiculous if there is actually no Apple documentation.

Does anyone know the actual final situation for iOS 5.

+4
source share
2 answers

In my experience, I have found that: - It is possible to set the total timeout value (i.e. 0.1 seconds) for HTTP GETS. - OS imposes a limit of 240 for HTTP POSTS with the body.

+1
source

This is not a connection that has an associated timeout, it is a request (which is done over the connection). See the documentation for NSURLRequest. The timeout interval is measured in seconds (not minutes, which is just the key).

Return value The receiver timeout interval in seconds.

Discussion If, during a connection attempt, the request remains inactive for longer than the timeout period, the request is considered to have been disconnected. *

Various Apple codes and documentation show timeouts in 60 seconds; therefore, 4 minutes may not be minimal.

+1
source

Source: https://habr.com/ru/post/1416064/


All Articles