For me, this is a fairly complete text. I understand the parts of each part of the code, but I cannot describe the logical flow of how it hangs together and works in general, starting with interpreting the "^" symbol after the completionHandler: method.
Can I ask for some help here to rewrite this code in a less concise way, which is less efficient but more visually understandable? I downloaded this code, and I can say that in the context of the program this is working code.
Thanks.
[[self stillImageOutput] captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler:^(CMSampleBufferRef imageSampleBuffer, NSError *error) { CFDictionaryRef exifAttachments = CMGetAttachment(imageSampleBuffer, kCGImagePropertyExifDictionary, NULL); if (exifAttachments) { NSLog(@"attachements: %@", exifAttachments); } else { NSLog(@"no attachments"); } NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer]; UIImage *image = [[UIImage alloc] initWithData:imageData]; [self setStillImage:image]; [image release]; [[NSNotificationCenter defaultCenter] postNotificationName:kImageCapturedSuccessfully object:nil]; }];
source share