Skip to content

Instantly share code, notes, and snippets.

@dokun1
Created March 27, 2014 23:11
Show Gist options
  • Save dokun1/9821212 to your computer and use it in GitHub Desktop.
Save dokun1/9821212 to your computer and use it in GitHub Desktop.
A simple example of calling one of my custom connection manager methods with a success and failure block, a-la AFNetworking
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[EDAConnectionManager sharedManager] getQuestionsWithSuccess:^(NSArray *questions) {
self.questions = questions;
dispatch_async(dispatch_get_main_queue(), ^{
[self.refreshControl endRefreshing];
[self.tableView reloadData];
});
}failure:^(NSError *error) {
NSLog(@"error: %@", [error localizedDescription]);
}];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment