How to enable a 'kiosk mode' programmatically in ipad?

走远了吗. 提交于 2019-11-27 21:26:44

问题


I'm making an application that needs users' complete attention till a specified target is achieved. before achieving the target, if a user tries to press 'home' button it should be disabled, or like 'kiosk mode' in ios6. I just needed to be done programmatically while start the application, dont like to do anything by manually changing in settings menu in iPhone/iPad After completion of target in my application, home button should be enabled. The application is targeted for enterprise. So no need for app store approval. How to do this? thanks in advance.

Edit: I read about "mobile configuration plist". That needed to reboot the device. But I dont like to reboot the device. Once when my application is started it should take care of everything(programmatically). I dont want the users/supervisor intervention in this. Just want to disable home button like in 'Guided access' but with programmatically inside my app. Is there any private api available from 'Guided Access' to disable the home button?

Note: Not for a Jail broken device. Targeted for enterprise licensed app.


回答1:


Zachary Christopoulos has a post on this using a "mobile configuration plist".

Once this profile is installed the first app that is launched when the device is rebooted will be the only app that will run until you reboot the device again.

Example plist from Zachary's post:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>PayloadContent</key>
    <array>
        <dict>
            <key>PayloadDescription</key>
            <string>Disables the home button.</string>
            <key>PayloadDisplayName</key>
            <string>Home Button Lock</string>
            <key>PayloadIdentifier</key>
            <string>com.zchristopoulos.kiosk</string>
            <key>PayloadOrganization</key>
            <string>Zachary Christopoulos</string>
            <key>PayloadType</key>
            <string>com.apple.defaults.managed</string>
            <key>PayloadUUID</key>
            <string>B2D02E2D-BAC5-431B-8A29-4B91F71C9FC1</string>
            <key>PayloadVersion</key>
            <integer>1</integer>
            <key>PayloadContent</key>
            <array>
                <dict>
                    <key>DefaultsDomainName</key>
                    <string>com.apple.springboard</string>
                    <key>DefaultsData</key>
                    <dict>
                    <key>SBStoreDemoAppLock</key>
                    <true/>
                    </dict>
                </dict>
            </array>
        </dict>
    </array>
    <key>PayloadDescription</key>
    <string>Disables Home Button</string>
    <key>PayloadDisplayName</key>
    <string>Home Button Lock</string>
    <key>PayloadIdentifier</key>
    <string>com.zchristopoulos.hbkill</string>
    <key>PayloadOrganization</key>
    <string>Zachary Christopoulos</string>
    <key>PayloadType</key>
    <string>Configuration</string>
    <key>PayloadUUID</key>
    <string>614D1FE3-F80D-4643-AF6B-D10C4CC8737A</string>
    <key>PayloadVersion</key>
    <integer>1</integer>
</dict>
</plist>



回答2:


Without employing private frameworks or having the device jailbroken you cannot disable the home button automatically. The closest thing you can do is have your end user employ the use of Guided Access to require a triple-click of the home button to exit the application. Guided Access must first be turned on in the Settings Application under General->Accessibility.

See Also: Disable Home Button Without Rebooting Device - Stack Overflow



来源:https://stackoverflow.com/questions/15068318/how-to-enable-a-kiosk-mode-programmatically-in-ipad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!