I am developing an iPhone app, that will not be distributed on AppStores. I have tried to search for private api but no luck. When the user tries to quit the app, I want to prompt the user to enter the correct password so as to enable him to exit the app. How can I achieve this? Thanks in advance. Cheers!!
-
what do u mean by 'correct password so as to enable him to exit the app' ? please elaborate. – mChopsey Apr 13 '12 at 06:45
-
when the user enters right password, only then the app can exit, else it will continue running. – Ganesh Nayak Apr 13 '12 at 06:47
-
2Is your goal to make your users hate you? – borrrden Apr 13 '12 at 06:54
-
2Not possible, and thank goodness. – Caleb Apr 13 '12 at 06:56
-
Its a requirement basically, disabling kids presses home button repeatedly. You know kids learn and experiment much quicker. – Ganesh Nayak Apr 13 '12 at 07:02
4 Answers
It sounds like you need something similar to iOS "Kiosk Mode" as described in this answer: Put an iPhone or iPad into 'Store Demo' mode
Using that description in conjunction with the following steps might achieve precisely what you want:
- Have a "Quit" button
- Show a password dialogue when it is pressed
- If it was correct, read an out of bounds array location (or do whatever) to crash the app
With that config installed you'd get stuck in whatever app you launch next, though.
-
1+1 Excellent and very useful link. I'm not sure it'll solve the OP's problem, but it's still very handy information. – Caleb Apr 13 '12 at 07:49
You can't! You'll have to password protect the launch instead.

- 4,127
- 1
- 34
- 45
-
there must be some private api? on exit? when he presses the home button or tries to force quit the app from multitasking. – Ganesh Nayak Apr 13 '12 at 06:57
-
If you want to prevent the user from quitting your app, you'll need to physically cover the home button. This isn't a bad solution if your goal is to do something like a kiosk or a point of sale system, where you probably want to mount an iPad in a secure enclosure to prevent tampering or theft anyway. There are quite a few such enclosures on the market in a variety of styles.
For a normal app, though, there's really no solution -- iOS isn't designed for whatever you're trying to do.

- 124,013
- 19
- 183
- 272
The only way I could think to do what you want (which is to prevent access to certain apps) would be to replace the SpringBoard application (this is the method used by Apple itself in the App store models of the iPhone and iPad that restrict the things you can do on the devices). @owenfi pointed at one way to do that without jailbreaking, but in general it is limited: you won't be able to "exit" the app, you will basically just be able to run a single app.

- 64,273
- 8
- 118
- 148