Check out How to encode something on a background thread and then post it on the main one iOS by JR. Here is an excerpt:
// encode image on background thread dispatch_async(dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0), ^{ NSData *imageData = result.namedArguments[@"image_data"]; UIImage *image = [UIImage...
The full article is available here.