AFHTTPSessionManager GET:... does not perform it's blocks when dispatch group waits. dispatch_group_wait waits really "FOREVER". In my code @"all done" never happens.
How can I make it work?
(sorry. as I see, most people are interested to know the reason to use dispatch groups here. The reason is to perform requests in loop and wait the last response is got. I intentionally did not show my loop in code, because the loop does not affect that blocks are not being performed)
dispatch_group_t group = dispatch_group_create();
NSString *urlString = @"someURLForExampleReturnJSON";
dispatch_group_enter(group);
[self.sessionManager GET:urlString parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject)
{
NSLog(@"success block execution");
dispatch_group_leave(group);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSLog(@"failure block execution");
dispatch_group_leave(group);
}];
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
NSLog(@"all done");