【发布时间】:2015-07-15 03:53:58
【问题描述】:
如何使用 NSURLConnection 连续发送 100+ 个请求,并在发送下一个请求之前等待每个响应,在发送请求 100 次循环时,仅收到前四个或五个请求的响应,其余请求作为请求超时得到响应,请帮我提供一些示例代码或参考
NSURLRequest *request=[NSURLRequest requestWithURL:[NSURL URLWithString:[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
_Connection=[[NSURLConnection alloc]initWithRequest:request delegate:self startImmediately:YES];
【问题讨论】:
-
为什么不在一个请求中发送它而不是单独发送 100 多个?
-
您希望在发送下一个请求之前同步返回响应吗?这是你想要的吗?
-
在您获得响应的委托方法中发送下一个请求。
-
是的,你是绝对正确的 user2829759
-
我使用for循环连续发送请求
标签: ios nsurlconnection nsurl nsurlrequest