14

I want that after installing my app from an OTA the home button of the device will not work at all so that user is unable to come out from the App. My digging led me to following results

A) I got a way to disable home button by a "mobileconfig" profile but it needs to restart the device and user have to open my app just after booting, i want to do this without restarting with something like Private Frameworks on non-Jail-broken devices. I want to know is that possible for non-jail-break devices?

C) If it is not possible to disable home button with Private Frameworks, then is there any way to open an app just after booting the device?, since certain jailbreak apps/ processes are loaded upon startup.

[NOTE: I don't want to submit my app to iTunes.]

Michael Kohne
  • 11,888
  • 3
  • 47
  • 79
GauravSTomar
  • 604
  • 1
  • 7
  • 26
  • Who is this app aimed at? Regardless of app store, disabling home button will make users think their device is misbehaving/broken. – occulus Oct 19 '12 at 10:03
  • 2
    We need it for educational assessment. We publish this app with an enterprise distribution certificate and our mobileconfig profile will auto uninstalled after examination is over. – GauravSTomar Oct 19 '12 at 10:09
  • 1
    We can do this with Apple Configurator: Supervised Devices, but it will cause harm to the users data. – GauravSTomar Oct 19 '12 at 10:12
  • I don't think there is any solution for problem. cydia would come with those type of tweaks, if it was – jogi47 Nov 01 '12 at 07:40
  • What I don't get is why you say Apple Configurator will cause harm to the users data. – Tivie Nov 08 '12 at 04:55
  • what you actualy want ? Disable Home Button of Device in your app or any thing else ? – Chintan Khetiya Nov 08 '12 at 05:02
  • @gauravstomar have you got the solution? I needed the same. – Ka-rocks Feb 25 '13 at 15:02

4 Answers4

19

In iOS6, there's a feature called "Guided Access", which will allow device owners to lock users (like toddlers and school kids) into an app.

This explains the Guided Access for iOS 6 apps.

The iOSDev
  • 5,237
  • 7
  • 41
  • 78
Meet
  • 4,904
  • 3
  • 24
  • 39
  • 2
    Thanks for your suggestion, but I want to do the same from my app. The Guided Access won't have an api or framework yet to use it from code. – GauravSTomar Nov 01 '12 at 06:59
  • @Rajneesh071, http://meta.stackexchange.com/questions/16065/how-does-the-bounty-system-work – iDev Nov 28 '12 at 04:02
1

The official answer of this question is "you can not disable home button in ios devices it is os level architecture and your are not authorized for it."

You need to dig to operating system flow to make any changes which might be quiet tough.

well, if you change you sight though it than there is one open and simple solution for this in ios 6 known as Guided Access.

PeterParker
  • 308
  • 4
  • 8
  • 3
    We can do this by a "mobileconfig" profile, but it need to reboot the device and open the specified app at just after booting. It is not a proper solution we want to do this without rebooting, which I think possible with Private Frameworks (Springboard, etc..). – GauravSTomar Nov 01 '12 at 07:10
1

If you are able to jailbreak your device create a LaunchDaemon or use an existing one. The LaunchDaemon is a file in plist format that is called upon rebooting and starting your device. You will also need a file named open created by K3A

Download open from here

You will need to move open to /usr/bin/ or you can put it inside your app does not matter but set permissions to 0755 and root:wheel

Now on to the LaunchDaemons, they are stored here

/System/Library/LaunchDaemons

Here is an example. Lets say you name the LaunchDaemon

com.gauravstomar.test.plist

Where it says com.bundle.identifier put your apps identifier you may also find it in your Info.plist inside of your apps directory where it says CFBundleIdentifier

Now inside the plist insert the following information

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.gauravstomar.test</string>
    <key>ProgramArguments</key>
        <array>
          <string>open</string>
          <string>com.bundle.identifier</string>
        </array>
    <key>RunAtLoad</key>
    <true/>
        <key>StartInterval</key>
        <integer>1</integer>
</dict>
</plist>

Label has to be the same name as the LaunchDaemon.plist excluding plist extension

ProgramArguments is what calls the file open and launches the app

RunAtLoad makes this plist launch upon reboot

StartInterval will make the LaunchDaemon.plist open back up after 1 second if the user exits the app, if the user is still in the app nothing will happened

Make sure the permissions for your LaunchDaemon is set to

0644 root:wheel

You can still use your mobileconfig so that the home button is disabled. Once assessment is complete you can disable the LaunchDaemon so that the app stops relaunching itself with the following command launchctl unload/System/Library/LaunchDaemon/com.gauravstomar.plist

Let me know if you need any more help.

Omar
  • 492
  • 4
  • 10
0

Without jailbreaking, the app is sandboxed. The app simply does not have access to mess with the home button. And you really shouldn't be messing with the home button.

In addition to "Guided Access", you can also make use of "Restrictions", which will allow you to disable everything accept opening your app. You can disable Apple specific apps including Safari, and prevent users from installing apps, deleting apps, making purchases, etc...

We have a number of iPod touches with a ticket scanning app we rent out to our customers. We make use of "Restrictions" to disable everything besides our app. The most helpful restriction thus far is preventing people from deleting apps - It's incredible how many people will accidentally delete an app, even after the warning prompt.

Luke
  • 13,678
  • 7
  • 45
  • 79