EXAMPLE
I will name my app Respring
In my app code I have an RespringViewController.h
and RespringViewController.m
Inside of the ResringViewController.h
I will add a button to call my respring action.
#import <UIKit/UIKit.h>
@interface RespringViewController : UIViewController
//Creates the button
- (IBAction) respring:(id)sender;
@end
Now inside of RespringViewController.m
#import "RespringViewController.h"
@interface RespringViewController ()
@end
@implementation RespringViewController
//This calls the button created in RespringViewController.h
- (IBAction) respring: (id) sender {
setuid(0); system("killall SpringBoard");
}
//This makes the view for the button programmatically
UIButton *button9 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button9 addTarget:self
action:@selector(respring:)
forControlEvents:UIControlEventTouchUpInside];
button9.frame = CGRectMake(96.0, 262.0, 130.0, 37.0);
button9.adjustsImageWhenDisabled = YES;
button9.adjustsImageWhenHighlighted = YES;
button9.alpha = 1.000;
button9.autoresizesSubviews = YES;
button9.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
button9.clearsContextBeforeDrawing = YES;
button9.clipsToBounds = NO;
button9.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
button9.contentMode = UIViewContentModeScaleToFill;
button9.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}");
button9.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
button9.enabled = YES;
button9.hidden = NO;
button9.highlighted = NO;
button9.multipleTouchEnabled = NO;
button9.opaque = NO;
button9.reversesTitleShadowWhenHighlighted = NO;
button9.selected = NO;
button9.showsTouchWhenHighlighted = NO;
button9.tag = 0;
button9.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:15.000];
button9.titleLabel.lineBreakMode = UILineBreakModeMiddleTruncation;
button9.titleLabel.shadowOffset = CGSizeMake(0.0, 0.0);
button9.userInteractionEnabled = YES;
[button9 setTitle:NSLocalizedString(@"APPLY SETTINGS", nil) forState:UIControlStateNormal];
[button9 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[button9 setTitleColor:[UIColor colorWithWhite:1.000 alpha:1.000] forState:UIControlStateHighlighted];
[button9 setTitleShadowColor:[UIColor colorWithWhite:0.500 alpha:1.000] forState:UIControlStateNormal];
//Adds the button to the view
[view addSubview:button9];
Now I go ahead and build it and get a file called Respring.app
Inside of Respring.app
there are for example these files
Info.plist
Icon.png
Respring
I have to rename Respring
inside of Respring.app
to Respring_
Now I have to upload the script below to /path/to/Respring.app/
#!/bin/bash
C=/${0}
C=${C%/*}
declare -a flags
[[ :${DYLD_INSERT_LIBRARIES}: == */MobileSubstrate.dylib: ]] && flags[${#flags[@]}]=--substrate
exec "${C:-.}"/Respring_ "${flags[@]}" -- "$@" 2>>/tmp/Respring.log
and name it Respring
You will now need to fake code sign the binary using the tool ldid
You can download it here
From the terminal use the following command
sudo ldid -S /path/to/Respring.app/Respring_
Be sure to sign the binary not the script
The correct permissions have to be in place for the script to launch app as root user from terminal you can run this
sudo chown 0:0 /path/to/Respring.app/Respring*
sudo chmod 0755 /path/to/Respring.app/Respring
sudo chmod 4755 /path/to/Respring.app/Respring_
Everything is all set now and you can launch the app, any logs will be stored inside of /tmp/Respring.log
of your device now and you can use the button to respring.