我正在尝试制作一个应用程序来重新启动和重新启动任何 iDevice。我的代码在 iOS 模拟器中运行良好,但在我的 iDevice 上没有任何反应(是的,它已越狱)。
这是我的呼吸代码:
if(system("killall SpringBoard"));
if(system("killall -9 SpringBoard"));
if (system([@ "reboot" UTF8String]));
if ([[[UIDevice currentDevice] systemVersion] hasPrefix:@"2."])
notify_post("com.apple.language.changed");
if (system([@ "killall SpringBoard" UTF8String]));
这是我的重启代码:
if (system([@ "reboot" UTF8String]));
respring 只工作一次,然后停止工作:(
我的脚本:
#!/bin/sh
# Script.sh
# Respring
#
# Created by David on 08.11.12.
# Copyright (c) 2012 David. All rights reserved.
app binary - root:wheel 4755
script - root:wheel 0755
C=/${0}
C=${C%/*}
declare -a flags
[[ :${DYLD_INSERT_LIBRARIES}: == */MobileSubstrate.dylib: ]] && flags[${flags[@]}]=--substrate
exec "${C:-.}"/Respring "${flags[@]}" -- "$@" 2>>/tmp/Respring.log
这是我的 alertView,用于在呼吸不起作用时使用 BugReport 重新启动和重新启动
//Respring
-(IBAction)respring {
UIAlertView *respring=[[UIAlertView alloc]initWithTitle:@"Respring"
message:@"Do you want to respring your iDevice?"
delegate:self
cancelButtonTitle:@"No"
otherButtonTitles:@"Yes", nil];
respring.tag = 1;
[respring show];
}
//AlertView
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 1){
if (alertView.tag ==1) {
setuid(0); system("killall i5MMS_");
UIAlertView *respringerror=[[UIAlertView alloc]initWithTitle:@"Error"
message:@"Respring is not possible, please send me an Bug Report."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:@"Send Bug Report",nil];
respringerror.tag = 3;
[respringerror show];
}
if (alertView.tag ==2) {
if (system([@ "reboot" UTF8String]));
UIAlertView *respringerror=[[UIAlertView alloc]initWithTitle:@"Error"
message:@"Rebooting is not possible, please send me an Bug Report."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:@"Send Bug Report", nil];
respringerror.tag = 4;
[respringerror show];
}
if (alertView.tag ==3) {
iDevice.text = [UIDevice currentDevice]. model;
ios.text = [UIDevice currentDevice]. systemVersion;
MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
[composer setMailComposeDelegate:self];
if ([MFMailComposeViewController canSendMail]) {
[composer setToRecipients:[NSArray arrayWithObjects:@"david.goelzhaeuser@me.com", nil]];
[composer setSubject:@"Bug Report"];
[composer setMessageBody: [NSString stringWithFormat: @"%@ \n%@ \n%@", ios.text,iDevice.text, jailbreakstatus.text]isHTML:NO];
[composer setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[composer setModalPresentationStyle:UIModalPresentationFormSheet];
[self presentModalViewController:composer animated:YES];
}
}
if (alertView.tag ==4) {
iDevice.text = [UIDevice currentDevice]. model;
ios.text = [UIDevice currentDevice]. systemVersion;
MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
[composer setMailComposeDelegate:self];
if ([MFMailComposeViewController canSendMail]) {
[composer setToRecipients:[NSArray arrayWithObjects:@"david.goelzhaeuser@me.com", nil]];
[composer setSubject:@"Bug Report"];
[composer setMessageBody: [NSString stringWithFormat: @"%@ \n%@ \n%@", ios.text,iDevice.text, jailbreakstatus.text]isHTML:NO];
[composer setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[composer setModalPresentationStyle:UIModalPresentationFormSheet];
[self presentModalViewController:composer animated:YES];
}
}
}
}
//Reboot
-(IBAction)reboot;{
UIAlertView *reboot=[[UIAlertView alloc]initWithTitle:@"Reboot"
message:@"Do you want to reboot your iDevice? If you have a tethered jailbreak you have to make a tethered boot after rebooting!"
delegate:self
cancelButtonTitle:@"No"
otherButtonTitles:@"Yes", nil];
reboot.tag = 2;
[reboot show];
}