Skip to content

Instantly share code, notes, and snippets.

@ddribin
Created January 24, 2010 19:40
Show Gist options
  • Save ddribin/285407 to your computer and use it in GitHub Desktop.
Save ddribin/285407 to your computer and use it in GitHub Desktop.
- (void) connectUsingBlock:(void (^)(BOOL success, NSError *error))block {
block = [block copy];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0),^(void){
NSError *err = nil;
BOOL success = YES;
dispatch_async(dispatch_get_main_queue(),^ {
block(success, err);
[block release];
});
});
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
[self connectUsingBlock:^(BOOL success, NSError *error) {
NSLog(@"Succes: %d", success);
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment