-1

UIApplication.shared.isIdleTimerDisabled should be true when screen is not active & false when screen is active.

Always getting false value even when screen is not active(i.e. black screen) Any way to determine the state of the screen?

Indrajit
  • 331
  • 1
  • 5
  • 12

1 Answers1

0

XCUITest runs outside of the process of your application, and has the ability to query your device and screen for certain properties.

For instance, you can take a screenshot of your screen, or press the device's home button.

https://developer.apple.com/documentation/xctest/xcuidevice https://developer.apple.com/documentation/xctest/xcuiscreen

It is not possible to directly query the on/off status of your screen, and I believe taking a screenshot of the screen wakes it up if it is asleep?

Max H
  • 121
  • 2