When I try to flash several times, the whole device hangs because "Lock Device" do not happen in the thread / queue.
The solution to wrap "Lock Device" with thread / queue.
That's what Swift would look like (Sorry for missing new lines) :
DispatchQueue.global(qos: .userInteractive).async { ... try device.lockForConfiguration() ... device.torchMode = .on ... device.unlockForConfiguration() ... }
When I try to flash several times, the whole device hangs because "Lock Device" do not happen in the thread / queue.
The solution to wrap "Lock Device" with thread / queue.
That's what Swift would look like (Sorry for missing new lines) :
DispatchQueue.global(qos: .userInteractive).async { ... try device.lockForConfiguration() ... device.torchMode = .on ... device.unlockForConfiguration() ... }