如何在Theos中向Jailbreak应用程序添加重启按钮

时间:2015-07-14 12:25:33

标签: ios button jailbreak reboot theos

要制作呼叫按钮,我可以按如下方式编写代码:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [btn setTitle:@"Respring" forState:UIControlStateNormal];
    btn.frame = CGRectMake(100,50,120,100);

    [btn addTarget:self action:@selector(buttonPushed:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
}

- (void)buttonPushed:(id)sender

{
    system("killall -9 SpringBoard");
    return;

}

但要制作重启按钮,它似乎无法做到这一点。 我应该写什么代码?

1 个答案:

答案 0 :(得分:0)

尝试做这样的事情:

- (void)buttonPushed:(id)sender

{
    [[UIApplication sharedApplication] reboot];
    return;

}

我在一个找到here的示例项目中尝试了这个并且它有效。我将模板的调用替换为

[[UIApplication sharedApplication] relaunchSpringBoard];

[[UIApplication sharedApplication] reboot];