I have this code, first written a few years ago now. The following code embodies the warnings I'm getting and I can't seem to find the new method of implementing such a simple bit of code. I've been trying all sorts of things suggested by Apple Resources to no avail. This code still works, with warnings, but I suspect will soon not work at all. Is there a new method to 'setFlashMode'?
'isFlashModeSupported:' is deprecated: and 'setFlashMode:' is deprecated:
+ (void)setFlashMode:(AVCaptureFlashMode)flashMode forDevice:(AVCaptureDevice *)device
{
if ([device hasFlash] && [device isFlashModeSupported:flashMode])
{
NSError *error = nil;
if ([device lockForConfiguration:&error])
{
[device setFlashMode:flashMode];
[device unlockForConfiguration];
}
else
{
NSLog(@"%@", error);
}
}
}
If I use from example 1 in Other Answer,
device.flashMode = AVCaptureFlashModeAuto; ...... 'flashMode' is deprecated: