首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >launchctl不在iOS应用程序中运行

launchctl不在iOS应用程序中运行
EN

Stack Overflow用户
提问于 2014-02-07 16:07:00
回答 1查看 1.2K关注 0票数 2

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

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

代码语言:javascript
复制
-(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 --它在终端机上工作..。

代码语言:javascript
复制
#!/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

从过去的十天开始我的头被撞了,还试着发射守护进程--它能工作,但能继续运行..永不倒下..。

这是我的守护进程。

代码语言:javascript
复制
<?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>

请帮帮我!!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-09 10:04:29

这是一些人的误解。

就因为你的手机坏了,apps don't run with root privileges

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

若要使应用程序以root权限运行,see this answer。否则,它将以用户mobile的身份运行。

launchctl需要root特权才能正常工作。

当然,您也可以删除启动守护进程。正确的方法是给你的应用程序根目录特权。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21632449

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档