My problem is as follows:-I have multiple asihttprequests and even i dont know how many, its like dynamic, at program runs I have 1 latlongarray for latitude-logitude which comes from webservice so i dont know how many latitudes longitudes are there.Then I will execute asihttprequest for getting distance from user location to all objects in latlongarray.So how can I recognize which request finished at method didfinishresponse for 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.
}
i already get distance with some 5 or 6 static asihttprequest but in this case i need to do somthing dynamically.how can i do this?
and thanx for any help!
You can store information in the 'userInfo' field in the request when you create it, which you can then use in requestDone:
request.userInfo = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"value", @"key", nil];