请查看以下代码:
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
通过取消按钮停止冻结请求的功能?
非常感谢您的帮助!