Disable home button without rebooting device

后端 未结 4 1464
执念已碎
执念已碎 2020-12-30 05:35

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 foll

4条回答
  •  伪装坚强ぢ
    2020-12-30 06:22

    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

    
    
    
    
        Label
        com.gauravstomar.test
        ProgramArguments
            
              open
              com.bundle.identifier
            
        RunAtLoad
        
            StartInterval
            1
    
    
    

    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.

提交回复
热议问题