I have iPhone application which overlays the camera with custom view. I have a button to switch between camera flash mode, this is the code
switch ([self.imagePi
Try to use AVCaptureDevice:
Class captureDeviceClass = NSClassFromString(@"AVCaptureDevice");
if (captureDeviceClass != nil) {
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
[device lockForConfiguration:nil];
if ([device hasTorch]) {
if (device.torchMode == AVCaptureTorchModeAuto) {
NSLog(@"Auto");
}
if (device.torchMode == AVCaptureTorchModeOn) {
NSLog(@"On");
}
if (device.torchMode == AVCaptureTorchModeOff) {
NSLog(@"Of");
}
}
if ([device hasFlash]) {
if (device.flashMode == AVCaptureFlashModeAuto) {
NSLog(@"Auto");
}
if (device.flashMode == AVCaptureFlashModeOn) {
NSLog(@"On");
}
if (device.flashMode == AVCaptureFlashModeOff) {
NSLog(@"Of");
}
}
[device unlockForConfiguration];
}