Flashmode deprecated?

Hi,


While maintaining some old Objective-C code, I encountered this statement:


  if ([videoDevice hasFlash])
  videoDevice.flashMode = AVCaptureFlashModeOff;


'videoDevice' is an instance of AVCaptureDevice.


The compiler issues this warning: "flashMode is deprecated. Use AVCapturePhotoSettings.flashMode instead."


I tried that:

  if ([videoDevice hasFlash])
  videoDevice.AVCapturePhotoSettings.flashMode = AVCaptureFlashModeOff;


Unsurprisingly, this code doesn't compile because there is no such property on AVCaptureDevice.


What is the compiler asking me to do here?


Thanks,

Frank

Looks like discussion and obj-c example from a '17 SO thread, here: https://stackoverflow.com/questions/47273601/how-do-you-set-a-devices-flash-mode-in-swift-4

I got the same problem. I followed this stackoverflow solution, but in this scenario I'm using AVCaptureSession and doining realtime processing. Is there any method to set flashMode on to AVCaptureSession?

Thanks.

Flashmode deprecated?
 
 
Q