I am trying to process the method asynchronously, according to the requirements, as soon as the first method is completed, only then should the second method begin. The problem is that the first method itself has code that runs in the background thread.
I tried dispatch_semaphore_wait, but that didn't work either.
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0); dispatch_group_t group = dispatch_group_create(); dispatch_group_async(group, queue, ^{ [self firstMethod]; NSLog(@"firstMethod Done"); }); dispatch_group_notify(group, queue, ^ { NSLog(@"1st method completed"); NSLog(@"2nd method starting"); [self secondMethod]; });
FirstMethod itself runs on a different workflow like this
-(void)firstMethod { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
What is the best way to achieve it, I cannot change the definition of firstMethod, as provided by some third party, and also to change this means changing a large amount of existing code from which this method is called
iHS source share