【发布时间】:2011-11-04 17:50:18
【问题描述】:
请看下面的代码:
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:<...> cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:3.0];
<...>
[NSURLConnection sendSynchronousRequest:request returningResponse:&WSresponse error:&WSerror]
下面的代码是从后台线程调用的:
[self performSelectorInBackground:@selector(<...>) withObject:nil];
有时 sendSynchronousRequest 的工作时间远远超过 3.0 秒。 (大约 1 分钟)。
- 如何设置真正的超时而不是不工作
timeoutInterval:3.0? - 如何添加一个功能,让用户可以随时通过取消按钮停止冻结
NSURLConnection请求?
非常感谢您的帮助!
【问题讨论】:
标签: iphone nsconnection