i want to find out if the user has set the auto locking time to something different than never. I already figured out how to check, if the passcode is enabled, but i dont find anything to check if the screen will lock automaticly for the device.
Asked
Active
Viewed 768 times
1
-
I'm not sure if there is a way to check the setting of lock time but changing `UIApplication.shared.isIdleTimerDisabled` value to `true` prevents device from going into sleep mode even if no user interaction is made. So by controlling this value you'd know if the device will go into sleep mode or not. This documentation might help find what you are looking for [isIdleTimerDisabled](https://developer.apple.com/reference/uikit/uiapplication/1623070-isidletimerdisabled) – Ayazmon Jan 05 '17 at 09:00
-
@Ayazmon: thx for the comment. You can use `UIApplication.shared.isIdleTimerDisabled` to avoid going to lock screen, but i need to get the setting because of security reasons. So when the user has set this setting to never, the app will not support it and will stop doing things what it would do normaly ... – Björn Ro Jan 05 '17 at 09:02
-
Hi @BjörnRo, is there any update? – Jenny Tran Jun 13 '23 at 02:54
1 Answers
0
You could come up with all sorts of weird and wonderful ways to infer the security configuration of non-managed devices on iOS.
One such daft way is to have a two-minute countdown timer display when a user opens the app for the first time, and ask them politely not to touch the screen or buttons. Then test to see if the app was suspended/backgrounded during this time. This wont tell you if the user cheekily changes their settings immediately after the first launch of course.
Ultimately though, if your app is sensitive enough to require this level of security governing, it needs to be able to trust the device its living on... and should probably not be living on a non-managed device.

hiburn8
- 473
- 5
- 12