Yay! Now that we have theos installed we are now going to develop out first tweak, let's start.
Now before we start coding up your tweak you will need to know Objective C and logos which are the two main programming languages used to develop Cydia tweaks but don't worry I will be creating tutorials on Objective C :)
First we need to know what a header file is, so in basic terms a header file is where all of the methods are declared and there is an implementation file in which a person writes what they want to happen when this method is run and I will give an example now.
For example if we are creating an app we will have two main files so in our header (.h) file we could create a method called "whenAppLaunches" and this will be the method of when our app launches and in our implementation file we would write "whenAppLaunches { "Display a photo" } so when we open our app it will display a photo. The header file is where we declare and define our methods and the implemnetation file is where we write down what our method is going to do so in our example we just declared the method of the app launching but in the implementation file we wrote what we want to happen when that method is ran.
Hopefully that explains it all and if it doesn't message me on twitter and I will explain it all to you to the best I can. So now we will open our tweak.xm file in which we are going to write the code of what happens when the springboard launches. We need to go back to our header folders and find the header file which contains all of the springboard methods and this file is called springboard.h which is obvious. We need to find the method of when the springboard launches so that we can write out own alert in there, and to make things easier the method of springboard launching is "-(void)applicationDidFinishLaunching:(id)fp8". The "-(void)" means its a method so anything that starts with -(void) is a method in objective C. So now lets head back to out tweak.xm file and lets start out code.
Overall our code should look like %hook SpringBoard -(void)applicationDidFinishLaunching:(id)application { %orig; UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Hello" message:@"Yoooo" delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil]; [alert show]; [alert release]; } %end
Just to point out the "alert show" code will just show the alert and the alert release will give back memory that it has borrowed but we don't need to know about this :) and now in out makefile right at the top we want to add these lines depending if you're on IOS or windows. If you're on IOS right at the top add the line "ARCHS = armv7 arm64" and under WelcomeMe_files= Tweak.xm add this line which is "WelcomeMe_FRAMEWORKS = UIKit" which shows us that we are using the UIKit framework and we are using a UIAlertView. If your're on windows do the same as iPhone but right at the top add this line "export THEOS_DEVICE_IP = YOURIP" and replace "YOURIP" with your actual ip address and you can get this by going into settings>wifi and clicking that little i. Now your makefile should look like this for IOS ARCHS = armv7 arm64 SDK = iPhoneOS8.1 include theos/makefiles/common.mk TWEAK_NAME = WelcomeMe WelcomeMe_FILES = Tweak.xm WelcomeMe_FRAMEWORKS = UIKit include $(THEOS_MAKE_PATH)/tweak.mk after-install:: install.exec "killall -9 SpringBoard" and for windows your makefile should look like this ARCHS = armv7 arm64 export THEOS_DEVICE_IP = 192.132.9.0 SDK = iPhoneOS8.1 include theos/makefiles/common.mk TWEAK_NAME = WelcomeMe WelcomeMe_FILES = Tweak.xm WelcomeMe_FRAMEWORKS = UIKit include $(THEOS_MAKE_PATH)/tweak.mk after-install:: install.exec "killall -9 SpringBoard" but remeber to use your own ip and not the same as mine if you are developing on windows.
Now we have built are tweak we must install this so lets install this bad boy.
To install on IOS open up mobile terminal and login as root (if you don't know refer back as I have talked about this before) and once you have logged in as root type in this command "cd /var/mobile/welcomeme" and press enter and your device should respring and you should see an alert :)
Thanks for reading my tutorial on your first tweak and if you are confused or face any error message me and I will always be helping you guys and I will be making many more tutorials on tweaks and I will be making a lot on objective c so don't worry if you are confused right now :P >