-8

I need to set a timer to lock an iPhone from my app. While using the application, after 3 to 5 minutes the phone should become locked.

emix
  • 14,448
  • 10
  • 62
  • 82

2 Answers2

1

You cannot lock the screen programmatically without any private API. Even if you use a private API, your app may probably be rejected by App Store.

However you can indeed achieve by sending keyboard events from paired bluetooth hardware devices. But that means your code depends on a Bluetooth connection and I cannot think of any practice use of that. To do this with Bluetooth, click here.

Fangming
  • 23,035
  • 4
  • 95
  • 87
1

Short answer: You can't.

Long Answer: For the security of iOS users, Apple does not allow any application to work with important hardware matters, such as locking the iPhone or controlling the usage of other apps. If your app even attempts to do such a thing (using any method, like external APIs), your app will immediately be rejected by Apple. It is not even worth trying.

Mr. Xcoder
  • 4,580
  • 5
  • 25
  • 43