-2

I have an application in which I want to lock the iPhone programmatically so that the user can't perform any action.

How can I determine the user is not working with the iPhone for some period, and after that period automatically lock the phone?

Such applications are used in all phone devices, where the user can set an auto-lock time and then the device will automatically lock if the user does not handle the device. How is it done programmatically? Please give me one example of the code so I can perform this easily.

I am new to iPhone programming, and I am struggling in my application. Help me. Thanks in advance.

jscs
  • 63,694
  • 13
  • 151
  • 195
Yogesh
  • 127
  • 1
  • 3
  • 10
  • 2
    Sorry, but this is unreadable. Why did you move all your periods at the end of the question instead of putting them in the right places? – ySgPjx Mar 31 '11 at 11:05

2 Answers2

2

(For your lock the iphone device through programatic only )

Impossible. But , you could prevent your phone from locking when your app is running.

[UIApplication sharedApplication].idleTimerDisabled = YES

Jhaliya - Praveen Sharma
  • 31,697
  • 9
  • 72
  • 76
0

There is no way to disable the Home Button in iOS using the documented API. The user will always be able to get back to the home screen or close your application using the Home Button.

Even if you find a way do it (which is very unlikely) your app will be definitely rejected from the App Store for a blatant violation of the iOS Human Interface Guidelines. If I were you I would reconsider implementing this behaviour, frankly, it's just not a good idea.

If you're only looking for blocking the the UI of your app, check out the answers to this question, more specifically, check out the incredibly useful MBProgressHUD library:

MBProgressHUD MBProgressHUD

Community
  • 1
  • 1
Tamas Czinege
  • 118,853
  • 40
  • 150
  • 176