gddjyg
Last Updated: February 25, 2016
·
5.014K
· raulraja

Async Block in Objective-C

Run an operation on the background then update the main UI thread.

dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(queue, ^{
    //do your work in the background here
    dispatch_async(dispatch_get_main_queue(), ^{
        //tell the main UI thread here
    });
});