Apple のAVCam ソース コードを使用してカスタム カメラを作成しています。フラッシュのオン/オフを切り替えようとしていますが、機能しません。これが私のコードです。何が問題なのかわかりません。AVCam初心者です。
- (void) toggleFlash:(id)sender {
dispatch_async([self sessionQueue], ^{
AVCaptureDevice *currentVideoDevice = [[self videoDeviceInput] device];
AVCaptureDevicePosition currentPosition = [currentVideoDevice position];
if(currentPosition == AVCaptureDevicePositionUnspecified || currentPosition == AVCaptureDevicePositionBack) {
if([currentVideoDevice hasFlash]) {
[currentVideoDevice lockForConfiguration:nil];
[currentVideoDevice setFlashMode:AVCaptureFlashModeOn];
[currentVideoDevice unlockForConfiguration];
}
}
});
}
コードの各行を通過し、これからエラーをログに記録しませんが、それでも運はありません。