Skip to content

Instantly share code, notes, and snippets.

@level09
Created June 21, 2012 11:28
Show Gist options
  • Save level09/2965229 to your computer and use it in GitHub Desktop.
Save level09/2965229 to your computer and use it in GitHub Desktop.
iOS Run a task in background with a callback
dispatch_queue_t queue = dispatch_queue_create("yourname", NULL);
// execute a task on that queue asynchronously
dispatch_async(queue, ^{
//Code to execute here
dispatch_async(dispatch_get_main_queue(), ^{
// Callback on the main thread when code above is done
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment