Skip to content

Instantly share code, notes, and snippets.

@priore
Created October 25, 2013 23:42
Show Gist options
  • Save priore/7163501 to your computer and use it in GitHub Desktop.
Save priore/7163501 to your computer and use it in GitHub Desktop.
How to manage the image asynchronously from a UIImagePicker
// How to manage the image asynchronously from a UIImagePickerController
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// hide UIImagePickerController
[picker dismissViewControllerAnimated:YES completion:^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_current_queue(), ^{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
UIImage *originalImage = [info objectForKey:UIImagePickerControllerOriginalImage];
if (photo) {
// TODO: you code here....
}
});
});
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment