launchctl无法在iOS App中运行

时间:2014-02-07 16:07:01

标签: 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.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
自从过去十天以来,我一直在b,,,,,Launch Launch Launch Launch Launch Launch Launch Launch Launch Launch Launch Launch Launch Launch Launch Launch Launch Launch Launch

这是我的守护进程..

<?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>

请帮帮我!!

1 个答案:

答案 0 :(得分:1)

这是一些人的误解。

仅仅因为你的手机被越狱,apps don't run with root privileges

仅因为您的应用已安装在/Applications/中,它就无法以root权限运行。

使您的应用以root权限see this answer运行。否则,它将以用户mobile运行。

launchctl需要root权限才能正常运行。

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