如何在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;
}

但是要使重启按钮,它似乎不能这样做。
我应该写什么代码?

试着这样做:

- (void)buttonPushed:(id)sender
{
    [[UIApplication sharedApplication] reboot];
    return;
}

我在这里找到的一个示例项目中尝试了这个,它工作了。我替换了模板对

的调用
[[UIApplication sharedApplication] relaunchSpringBoard];

[[UIApplication sharedApplication] reboot];

最新更新