I need to load three different datasets from three different URLs. I decided to use ASIHTTPRequest. Two of the URLs are the JSON channels I need to parse, and one of them is a .txt file that I need to store locally.
Now the example that is on the ASIHTTPRequest website for an asynchronous request shows the following:
- (IBAction)grabURLInBackground:(id)sender { NSURL *url = [NSURL URLWithString:@"http://allseeing-i.com"]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request setDelegate:self]; [request startAsynchronous]; }
To pass multiple URLs, I can call a βrequestβ at three different URLs. But I'm not sure how I will handle them in the requestFinished method. The documentation shows this as:
- (void)requestFinished:(ASIHTTPRequest *)request { // Use when fetching text data NSString *responseString = [request responseString]; // Use when fetching binary data NSData *responseData = [request responseData]; }
How would this method distinguish between different requests so that I could handle it differently?
Thanks,
source share