OlyDJ
iOS9 iOS9 iOS9 iOS9 iOS9 iOS9 iOS9 iOS9

Selecciona idioma

Spanish English

First tweak tutorial

by OlyDJ

Do you want to be a iOS deveolper? It´s really easy to start if you follow this tutorials. Today we gonna create our first tweak project.


First tweak

    OK! Here we are... We have Theos installed and configured, so now we are going to create our first tweak. By now we are going to disable SpotLight gestures. I want to explain everything, but we can spend some days to do it. So there are some steps that I explain in nexts tutorials. Note that iOS is a case sensitive system. Let´s go!


    • 01- Open up MobileTerminal, enter "su" and password, and type "/var/theos/bin/nic.pl" (this comand let us create a new empty project)
    OlyDJ
    • 02- Now we must select what we want, so select "Tweak" (for me it´s number 7). It prompts for project name, that will be the real name inside Cydia (example: MetaMorph). Type "FirstTweak" and hit Enter.

    • 03- Next it asks for Package name, type it in minus. The second word is for Package identification, you can type what you want (example: com.oly.metamorph). By default the name will be "com.yourcompany.firsttweak"

    • 04- Now you can write the Author/Mantainer name, that will be your name. Hit Enter.

    • 05- Now it prompts for the bundle filter (the desired "class" we want to change). So only hit enter for default value.

    • 06- Next hit enter again for default value.

    • 07- Now we have a folder named as your tweak (firsttweak) inside "/var/mobile". So let´s go inside by typing "cd firsttweak" and hit Enter.

    • 08- Open up iFile/Filza and go to same folder "/var/mobile/firsttweak". Ok! here is our project, there are 4 files and a folder (it´s a link, not a folder)
    OlyDJ
    • 09- First of all open "Makefile" file (it has no extension, so iFile/Filza prompts how to open it), select "TextEditor".

    • 10- We must add some lines here. At the beginning of the document, we must type:

    THEOS_PACKAGE_DIR_NAME = debs

    TARGET = iphone:clang

    ARCHS = armv7 arm64 armv7s

    OlyDJ

    Let´s understand what is this... First line creates a folder named debs inside our project folder to contain every packages. So when we compile our project the resulting DEB file will be in this folder.

    Second line tells to the device that this tweak is created for iPhone (this does not limit our tweak to iPhone, it can work on iPad and iPod too).

    Next line is for iOS architecture.

    This is for every projects. Make sure to do this everytime you want to create something.


    • 11- Save, close file and open "tweak.xm" (again with TextEditor). Select all and delete it, so now there is nothing inside. We must add this lines:

    %hook SBSpotlightSettings

    -(BOOL)enableSpotlightOnMinusPage {

    return FALSE;

    }

    -(BOOL)enableSpotlightHomeScreenGesture {

    return FALSE;

    }

    %end

    OlyDJ

    This is the tweak itself. First line tells to our device that we want to hook(change, modify...) Spotlight Settings, which is a class inside SpringBoard framework (iOS system is divided by frameworks. Each framework is divided by classes, and every class are divided by methods)

    Second line is the first method we need to change. "BOOL" is a value of TRUE/FALSE (or YES/NO). "enableSpotlightOnMinusPage" is the method itself. the symbol "{" is the open symbol. Between the braquets there will be the changes we want for this method.

    Third line is the change we want, so we "return" the value "FALSE" (because this method is boolean, we only can return 2 values), and we close the line with ";"

    Next we have the closing braquet that we opened on second line (so now we have a line of code inside the braquets)

    We want to disable spotlight from both Swipe left and swipe down gestures, so next we must add the second method (which is the same structure like the other one)

    At the end of our methods we have "%end" which means that we finish hooking that class.


    • 12- Save tweak.xm and close it.
    • 13- Go back to MobileTerminal (remember that you already has logged with root and you are inside our root project folder), type "make package messages=yes" and hit Enter.
    OlyDJ

    Now we are compiling our tweak, you will see how theos do the magic. If all is OK then you can go with iFile/Filza to our "debs" folder inside our project.

    OlyDJ

    Just install it and check if you can start Spotlight. Now think on this: if you are changing Spotlight, and you have another tweak which do the same, what can happend? Exactly... SpringBoard crash, Safe Mode, etc... Even boot logo stacked... Those things can be "repaired" (unisnstalling one of those tweaks) with Substrate (another tutotial for that issues).


Next tutorial: Create a preference panel to enable/disable our tweak.