Question

i am trying to stop and start com.apple.mobile.installd from my app which is for jailbroken phone. i tried almost every possible way NSTask, system(), shell script but its not working. can someone help me out??

below are my code samples i tried.

-(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");
}

my reload.sh it works from terminal..

#!/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

bangging my head since last ten days, Also tried Launch Daemon it works but keeps on running.. never goes down..

Here is my daemon..

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

Please help me out!!

Était-ce utile?

La solution

This is a misconception some people have.

Just because your phone is jailbroken, apps don't run with root privileges.

Just because your app is installed in /Applications/, it won't run with root privileges.

To cause your app to run with root privileges, see this answer. Otherwise, it will run as user mobile.

launchctl needs root privileges to function properly.

P.S. And, of course, you can remove the launch daemon. The proper way to do it is simply to give your app root privileges.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top