I have two webservices (JSON), one is called at the ViewDidLoad and it returned a array of values and loaded into Array1. And I need to call another webservice, by parsing each values of Array1. I tried something like this:
for (pointer=0; pointer<=[Array1 count]; pointer++) {
NSString *test = [Array1 objectAtIndex:pointer];
NSString *urlString2 = [NSString stringWithFormat:@"http://service=%@",test];
NSURLRequest *request2 = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString2]];
connection2 = [[NSURLConnection alloc] initWithRequest:request2 delegate:self];
}
How to call this function to load the output into an array?
A help will be much appreciated..
Thank you
You have not shown how you are executing the NSURLRequests requests you created within your loop. If you are trying to call them synchronously, then you can do something like:
If instead you are trying to call the request asynchronously using self as the delegate, then you will have to do some trickier work here because all of your responses for all of your requests will come in to the same delegate. It’s possible but you may want to define a dedicated objects to act as delegates for each individual request in this case…