0

I want to stop users from launching my app if Auto-Lock time is set to Never on iPhone. Any thoughts on how I can find out the value for Auto-Lock?

Martin Zikmund
  • 38,440
  • 7
  • 70
  • 91
C B
  • 63
  • 9
  • in native iOS you can do like this application.idleTimerDisabled = true on your AppDelegate. Try this one – Prasanth Mar 21 '19 at 10:13
  • Unfortunately that seems to be the opposite - this will prevent the screen from turning off, but the OP wants to make the app not launch when the screen auto-locking is turned off instead. – Martin Zikmund Mar 21 '19 at 10:24
  • I would approach this issue in a different way by using iOS's local authentication. That way you could programmatically determine first access to app, perform local auth, no activity within my app in the last XX seconds, local auth the app when it comes back from a background state, etc... (same way financial apps, etc... work) : https://developer.apple.com/documentation/localauthentication?language=objc – SushiHangover Mar 21 '19 at 12:41

1 Answers1

1

It is currently not possible to do this via the available public APIs so you probably won't be able to implement this functionality.

You can however track the last user input, so that you could for example "log out" your app after a period of inactivity. This has been described for example in this SO question.

Martin Zikmund
  • 38,440
  • 7
  • 70
  • 91