关于iOS5的NSURLConnection超时有什么情况? [英] What is the situation regarding the NSURLConnection timeout with iOS5?

查看:87
本文介绍了关于iOS5的NSURLConnection超时有什么情况?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找到一个确定的答案,如果可以在iOS 5中设置使用NSURLConnection的超时值(我想将其设置为30秒)。

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

我搜索了过去的帖子,但信息似乎相互矛盾。例如,此帖子

I've searched past postings on this but the information seems contradictory. For example, this posting

NSURLConnection超时?

表示Apple要求最短4分钟超时 - 但我找不到任何Apple文档来支持这一点。

says Apple mandates a 4 minute minimum timeout - though I cannot find any Apple documentation to support this.

这是发帖称240限制来自苹果论坛帖子
NSMutableURLRequest不服从我的timeoutInterval

THis posting says the 240 limit comes from an apple forum thread NSMutableURLRequest not obeying my timeoutInterval

他们说这个限制仅适用于主体不为空时的POST。这是否意味着可以为GETS设置超过4分钟的超时时间?

They say this limit is only for POSTs when the body isn't empty. Does that imply its possible to set the timeout less than 4 minutes for GETS?

有人在这里评论说iOS 5并非如此,但是他们被拒绝投票给了
NSMutableURLRequest不遵守我的timeoutInterval

Somebody commented here that that's not the case with iOS 5, however they were down voted NSMutableURLRequest not obeying my timeoutInterval

还有其他人在说其他的事情,但无论如何,以前关于这个主题的大多数帖子似乎是在几年前的iOS 5之前。

And there's other's saying other things but anyway most of the previous postings on this topic seem to be from a couple of years ago prior to iOS 5.

如果有一个4分钟的限制,然后不得不依赖传闻知道这是有点荒谬,如果真的没有Apple文档。

If there is a 4 minute limit then having to rely on hearsay to know this is a bit ridiculous if there truly is no Apple documentation.

有没有人知道iOS 5的实际确定情况。

Does anybody know the actual definitive situation on this for iOS 5.

推荐答案

根据我的经验,我发现:
- 可以为HTTP GETS设置任何值的超时值(即0.1秒)。
- 操作系统确实对带有正文的HTTP POSTS施加了240的限制。

In my experience I have found that: - Its possible to set a timeout value of anything (i.e. 0.1 seconds) for HTTP GETS. - The OS does impose a limit of 240 for HTTP POSTS with a body.

这篇关于关于iOS5的NSURLConnection超时有什么情况?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆