Keep iPhone Unlocked while Debugging with Rider

41 Views Asked by At

I'm writing an app using MAUI. When debugging with Rider, if the iPhone locks, the debug link drops. Which is annoying.

Now, I know I can set my phone to not auto-lock. However, crucially, it's my phone not a work phone and I don't want to have to change it every day.

Is there any way to prevent the device auto-locking when I'm debugging?

1

There are 1 best solutions below

1
FreakyAli On BEST ANSWER

You could turn the screen on for debugging.

Under debug, invoke this method:

#if DEBUG
public void ToggleScreenLock()
{
    DeviceDisplay.KeepScreenOn = !DeviceDisplay.KeepScreenOn;
}
#endif

It should be on the main thread.