I have realized that these two urls do not returns data at the same time. I would like to know how I could able to make sure that urls return at the same time. How could I able to change this code to GCD. Is that recommended? I have created dispatch queue in the code but it does not plot anything, not working. without GCD it works but it does not return at the same time. Any help would be appreciated!
-(void)httpRequest{
_weak ASIHTTPRequest *request1 = [ASIHTTPRequest requestWithURL:url1];
[request1 setCompletionBlock:^{
NSString *responseString1 = [request1 responseString];
//dispatch_async(backgroundProcess1,^(void){
[self plotOverlay1:responseString1];
//});
}];
[request1 setFailedBlock:^{
NSError *error=[request1 error];
NSLog(@"Error: %@", error.localizedDescription);
}];
[request1 startAsynchronous];
_weak ASIHTTPRequest *request2 = [ASIHTTPRequest requestWithURL:url2];
[request2 setCompletionBlock:^{
NSString *responseString2 = [request2 responseString];
//dispatch_async(backgroundProcess2,^(void){
[self plotOverlay2:responseString2];
//});
}];
[request2 setFailedBlock:^{
NSError *error=[request2 error];
NSLog(@"Error: %@", error.localizedDescription);
}];
[request2 startAsynchronous];
}