At the moment I have an asynchronous download (the download does not stop the program), I need the program to load the data in this section of the code and only then continue (synchronous loading), how to implement it?
NSURL *url = [NSURL URLWithString:lineURLresult]; // URL NSURLSessionDataTask *downloadTask = [[NSURLSession sharedSession] dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { id object = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error]; { if ([object isKindOfClass:[NSDictionary class]] && error == nil){ id object = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error]; [_tableViewData addObject:object]; dispatch_async(dispatch_get_main_queue(), ^{ // обновление UI }); } } }];