Last active
December 12, 2015 01:58
-
-
Save danlipert/4694932 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[self stillImageOutput] captureStillImageAsynchronouslyFromConnection:videoConnection | |
completionHandler:^(CMSampleBufferRef imageSampleBuffer, NSError *error) { | |
if(!error) | |
{ | |
if(imageSampleBuffer != NULL) | |
{ | |
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer]; | |
UIImage *image = [[UIImage alloc] initWithData:imageData]; | |
NSLog(@"Captured image size: %f, %f", image.size.width, image.size.height); | |
[self setStillImage:image]; | |
[image release]; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[self.delegate photoCaptureSessionDidCaptureImage:self.stillImage withOrientation:orientation]; | |
}); | |
} | |
} else { | |
NSLog(@"ERROR TAKING PHOTO"); | |
} | |
}]; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment