我正在为iOS创建一个相当雄心勃勃的项目,我需要在启动阶段,在跳板实际启动之前运行一些代码。我知道这可能会损害设备,但这非常关键。我注意到,虽然越狱使用evasi0n的iPad Mini,越狱实际上在启动时运行代码(它实际上复制了一些文件并显示图像)。关于我怎么做的任何想法?
P.S。我已经检查过,没有evasi0n的源代码:(
答案 0 :(得分:1)
您可以创建启动守护程序并进行安装。您应该执行以下步骤:
创建程序(带main()
的普通可执行文件等)并将其放入标准可执行路径之一。我建议您为此目的使用/usr/libexec/
。
在/System/Library/LaunchDaemons/
中创建一个属性列表,其名称是任意捆绑ID(例如com.mycompany.NastyLaunchDaemon.plist
),其内容如下:
<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>
重启设备后,程序将运行。