Invoke code from the main queue

Posted by Daniel Vela on March 24, 2015

To invoke some code from the main queue thread in iOS use the following code:

dispatch_async(dispatch_get_main_queue(), ^{ /* some code like show an alert view */ });