Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GCD FAIL
- (void)loadA
{
}
- (void)loadA
{
[[self aDataSource] loadAWithOnLoad:^(NSArray *newObjects) {
NSLog(@"WAIT 1");
} onError:^(NSError *error) {
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}];
}
- (void)loadB...loadC....
- (void)reload
{
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_group_t group = dispatch_group_create();
dispatch_group_async(group, queue, ^{
[self loadA];
});
dispatch_group_async(group, queue, ^{
[self loadB];
});
dispatch_group_async(group, queue, ^{
[self loadC];
});
dispatch_group_notify(group, queue, ^{
NSLog(@"WAIT FINAL");
});
dispatch_release(group);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.