torch level

why the setTorchModeOn not working? it not change the level torch

    guard let device = AVCaptureDevice.default(for: .video) else { return }

    if device.hasTorch {
      do {
        try device.lockForConfiguration()
        try device.setTorchModeOn(level: 0.1)
        if on == true {
          device.torchMode = .on
        } else {
          device.torchMode = .off
        }

        device.unlockForConfiguration()
      } catch {
        print("Torch could not be used")
      }
    } else {
      print("Torch is not available")
    }
  }

Hello,

That code works for me on iPhone 14 Pro. If you're unable to figure out what the issue is, I recommend requesting technical support and providing a focused sample project.

torch level
 
 
Q