iOS设备激活执行shell脚本 [英] iOS execute shell script from Activator
问题描述
我使用的是越狱的iOS设备,我要添加到激活的动作执行存储在一个已知位置的shell脚本。有谁知道如何实现这一目标?
I am using a jailbroken iOS device, and I want to add an action to Activator that executes a shell script stored in a known location. Does anyone know how to achieve this?
推荐答案
我不知道激活是否可以运行脚本的直接的,但它肯定可以运行任何应用安装在设备上,以任何你喜欢的动作(如刷卡,震动,按钮preSS)。只要使用了一个简单的应用程序系统()
功能,或 EXEC
函数来调用脚本:
I'm not sure whether or not Activator can run scripts directly, but it certainly can run any app you install on your device, with whatever action (e.g. swipe, shake, button press) you like. Just make a simple app that uses the system()
function, or an exec
function to invoke your script:
int main(int argc, char *argv[])
{
int returnCode = system("/bin/myscript.sh arg1 arg2");
return 0;
}
然后,设置激活来运行应用程序。
Then, setup Activator to run that app.
编辑:
这将导致一个简短的闪存作为的应用的启动,然后关闭。这也意味着,你正在运行将关闭任何其他应用程序(发送到后台)。如果你不喜欢这样,激活,您还可以建立一个出SBSettings的切换的,然后在用户定义的操作运行。请参见这里建设一个出SBSettings切换。你只需执行的setState
的方法是这样的:
That will cause a brief flash as the app starts, and then closes. This also means that any other app that you're running will be closed (sent to the background). If you don't like that, Activator also lets you build a SBSettings toggle, and then run it on a user-defined action. See here for building a SBSettings toggle. You would just implement the setState
method this way:
void setState(BOOL Enabled)
{
int returnCode = system("/bin/myscript.sh arg1 arg2");
}
这篇关于iOS设备激活执行shell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!