Before we can use the flashMode we must use lockForConfiguration.
My Code:
Code:
NSArray* devices = [AVCaptureDevice devices];
AVCaptureDevice* captDevice = nil;
NSLog(@"%d devices found", [devices count]);
for(AVCaptureDevice* device in devices)
{
if([device hasFlash])
{
NSLog(@"device has flash");
if ([device isFlashModeSupported:AVCaptureFlashModeOn]) {
if([device lockForConfiguration:&error])
{
device.flashMode = AVCaptureFlashModeOn;
}
}
}
}
}
But the flashlight is off :/ What´s wrong ?
Quote:
|
I have the same problem adding the AVFoundation.framework. (AVCaptureDevice is undeclared)
|
Test your Code on a iPhone 4. If you run this Code in Simulator it shows this error. If you use a Device it show´s no error