Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从iOS应用程序启动CTL不工作_Ios_Iphone_Objective C_Xcode5_Jailbreak - Fatal编程技术网

从iOS应用程序启动CTL不工作

从iOS应用程序启动CTL不工作,ios,iphone,objective-c,xcode5,jailbreak,Ios,Iphone,Objective C,Xcode5,Jailbreak,我正在尝试从我的应用程序停止并启动com.apple.mobile.installd,该应用程序用于越狱手机。我尝试了几乎所有可能的方法,包括NSTask、system()、shell脚本,但都不起作用。有人能帮我吗 下面是我尝试过的代码示例 -(IBAction)stopIntl:(id)sender { NSString *command = [NSString stringWithFormat:@"/bin/launchctl stop com.apple.mobile.insta

我正在尝试从我的应用程序停止并启动com.apple.mobile.installd,该应用程序用于越狱手机。我尝试了几乎所有可能的方法,包括NSTask、system()、shell脚本,但都不起作用。有人能帮我吗

下面是我尝试过的代码示例

-(IBAction)stopIntl:(id)sender
{
    NSString *command = [NSString stringWithFormat:@"/bin/launchctl stop com.apple.mobile.installd >> /Applications/loader.app/output.txt"];
    const char* new = [command UTF8String];
    system(new);
    NSLog(@"Stopping InstallD");
}

-(IBAction)startIntl:(id)sender
{
    NSString *command = [NSString stringWithFormat:@"/bin/launchctl start com.apple.mobile.installd >> /Applications/loader.app/output.txt"];
    const char* new = [command UTF8String];
    system(new);
    NSLog(@"Starting InstallD");
}

-(IBAction)reloadShell:(id)sender
{
    system("/bin/launchctl stop com.apple.mobile.installd");
    sleep(2);
    system("/bin/launchctl start com.apple.mobile.installd");

    NSLog(@"Reloading Shell");
}

-(IBAction)reloadShell1:(id)sender
{
    NSString *command = [NSString stringWithFormat:@"/usr/libexec/reload.sh >> /Applications/loader.app/output.txt"];
    system([command UTF8String]);
    NSLog(@"Reloading Shell1");
}
我的reload.sh从终端开始工作

#!/bin/sh

#  reload.sh
#
#  Copyright (c) 2014 Avanté Codeworx. All #rights reserved.

launchctl stop com.apple.mobile.installd
sleep 2
launchctl start com.apple.mobile.installd
exit
在过去的十天里,我一直在绞尽脑汁,也试着启动守护进程,但它一直在运行。。永远不会倒下

这是我的守护进程

<?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>LaunchEvents</key>
    <dict>
        <key>com.apple.notifyd.matching</key>
        <dict>
            <key>com.loader.reload</key>
            <dict>
                <key>Notification</key>
                <string>com.loader.reload</string>
            </dict>
        </dict>
    </dict>
    <key>Label</key>
    <string>com.avante.loader</string>
    <key>UserName</key>
    <string>root</string>
    <key>KeepAlive</key>
    <false/>
    <key>Program</key>
    <string>/usr/libexec/reload.sh</string>
</dict>
</plist>

发射口
com.apple.notifyd.matching
com.loader.reload
通知
com.loader.reload
标签
com.avante.loader
用户名
根
持久连接
节目
/usr/libexec/reload.sh

请帮帮我

这是一些人的误解

就因为你的手机被越狱了

因为您的应用程序安装在
/Applications/
中,所以它不会以
root
权限运行

要使您的应用程序以
root
权限运行。否则,它将作为用户
移动设备运行

launchctl
需要
root
权限才能正常工作


当然,您可以删除启动守护进程。正确的方法是给你的应用程序root权限。

我两天前解决了这个问题。。但是不经意间。。这对我所做的事情是一个很好的澄清。谢谢