【发布时间】:2011-06-20 08:28:11
【问题描述】:
我的问题如下:-我有多个 asihttprequests,甚至我不知道有多少,它就像动态的,在程序运行时我有 1 个纬度-logitude 的 latlongarray,它来自 web 服务,所以我不知道有多少纬度经度那里。然后我将执行 asihttprequest 以获取从用户位置到 latlongarray 中所有对象的距离。那么我如何识别在方法 didfinishresponse 为 asihttprequest 完成的请求:-
for(int i=0,i<[latlongarray count],i++)
if (![self queue]) {
[self setQueue:[[[NSOperationQueue alloc] init] autorelease]];
}
NSURL *url = [NSURL URLWithString:@"url for getting distance"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDelegate:self];
[request setDidFinishSelector:@selector(requestDone:)];
[request setDidFailSelector:@selector(requestWentWrong:)];
[[self queue] addOperation:request]; //queue is an NSOperationQueue
- (void)requestDone:(ASIHTTPRequest *)request
{
//I NEED TO DO SOMTHING HERE.
}
我已经与一些 5 或 6 个静态 asihttprequest 保持距离,但在这种情况下,我需要动态地做一些事情。我该怎么做?
感谢您的帮助!
【问题讨论】:
标签: ios xcode ios4 iphone-sdk-3.0 asihttprequest