I don't know how to synchronize NSURLSessionDataTask.
How do I synchronize these two sessions in syncInfo1Info2:
- (void) syncInfo1Info2
{
//How do I sync???
}
- (void) getSomeInfo1
{
NSString *stringToUrl = [[NSString alloc]initWithFormat:@"url"];
NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[stringToUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
NSURLSessionDataTask *task =[session dataTaskWithRequest: request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error){
//Some code...
}];
[task resume];
}
- (void) getSomeInfo2
{
NSString *stringToUrl = [[NSString alloc]initWithFormat:@"url"];
NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[stringToUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
NSURLSessionDataTask *task =[session dataTaskWithRequest: request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error){
//Some code...
}];
[task resume];
}