Вопрос

I am creating a rather ambitious project for the iOS and I need to run some code during the boot stage, before the springboard actually launches. I understand that this can harm the device, but it is extremely crucial. I noticed while jailbreaking an iPad Mini with evasi0n that the jailbreak actually runs code at boot (it actually copies some files and displays an image). Any idea on how I can do it?

P.S. I already checked, no source code for evasi0n lying around :(

Это было полезно?

Решение

You can create a Launch Daemon and install it. You should go through the following procedure:

  1. Create your program (a normal executable with main() etc.) and put it into one of the standard executable paths. I suggest you use /usr/libexec/ for this purpose.

  2. Create a property list in /System/Library/LaunchDaemons/ of which the name is an arbitrary bundle ID (e. g. com.mycompany.NastyLaunchDaemon.plist), and its contents are the following:


<plist>
<dict>
    <key>Label</key>
    <!-- this needs to match the file name without the .plist extension! -->
    <string>com.mycompany.NastyLaunchDaemon</string>
    <key>Program</key>
    <string>/usr/libexec/mynastylaunchd</string>
    <key>RunAtLoad</key>
    <true />
</dict>
</plist>

After you reboot your device, the program will run.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top