void saveImageToLibrary
whenを実行しようとしています
[self.avSnapper captureStillImageAsynchronouslyFromConnection:captureConnection
completionHandler:handler];
終わらせる。どうすればいいですか?
void saveImageToLibrary
whenを実行しようとしています
[self.avSnapper captureStillImageAsynchronouslyFromConnection:captureConnection
completionHandler:handler];
終わらせる。どうすればいいですか?
私はこれがあなたが望むものだと思います
[self.avSnapper captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler: ^(CMSampleBufferRef imageSampleBuffer, NSError *error){
CFDictionaryRef exifAttachments = CMGetAttachment( imageSampleBuffer, kCGImagePropertyExifDictionary, NULL);
if (exifAttachments){
// Do something with the attachments if you want to.
NSLog(@"attachements: %@", exifAttachments);
}
else
NSLog(@"no attachments");
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer];
UIImage *image = [[UIImage alloc] initWithData:imageData];
self.vImage.image = image;
}];
関数の完了時にコードを実行する必要がある場合は、「completionHandler」パラメーターがあります。
ドキュメントによると、「画像がキャプチャされた後に呼び出すブロック。」
編集: ブロックのプログラミングについてはこちらで読むことができます。ブロック表記は少し混乱する可能性があるため、役立つ簡単なトリックがあります。オートコンプリートを使用して XCode で関数シグネチャを作成すると、渡す必要のある変数のプレースホルダーが青色になります。これで、ブロックのプレースホルダーで「Enter」を押すと、XCode は一致する構文で空のブロックを生成します。