Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Developing Mobile Substrate tweaks

I have a few questions about developing mobile substrate tweaks.
First of all, how do you make them?

Do you have to use XCode?

What kind of files are needed and where do you place your code?

How do you hook into an app?

For example if I want to change something in the Messages app, how could I program it to hook into Messages.app?

I am pretty familiar with developing regular apps for the app store, and I am very interested in mobile substrate. I would really like to know how to do it and where to start. Thanks!

like image 783
JonasG Avatar asked Aug 18 '11 04:08

JonasG


2 Answers

By far, the easiest way to develop MS tweaks is to use Theos

Follow the instructions given on the link above to install theos, navigate to the folder you want to store the project in and run $THEOS/bin/nic.pl to generate a template for your tweak.

The generated Tweak.xm file is where you put your code. To build the project just navigate to the project directory in Terminal and run make. If have dpkg on your system, then you can package up and install the project easily. Make sure OpenSSH is installed on your iDevice and add this line to your project's makefile:

THEOS_DEVICE_IP = [INSERTDEVICESIPHERE]

Then run make package install to build your project, package it in a .deb, transfer it over to your device and install it.

The code that actually goes in the Tweak.xm file is objective-C with a language that simplifies Mobile Substrate tasks called Logos, which is explained here: http://iphonedevwiki.net/index.php/Logos. Generally though, the code follows this format:

%hook classname //declares the class from your application you're going to override

-(void)functionyouwanttooveride {

    dosomethingnew(); //put all your new code for the method here
    return %orig;     //this calls the original definition of the method and returns the result
}
%end //end hooking classname

To find out what classes and methods you need to override to do whatever you want to do, install class-dump from cydia, ssh into your device and run class-dump -H path/to/your/binary -o /path/where/you/want/your/classheaders. Then you just have to look through the resulting headers to find classes and methods that have names that seem relevant to what you're doing, and experiment with them.

Good luck!

like image 199
stonesam92 Avatar answered Nov 08 '22 20:11

stonesam92


I wrote a MobileSubstrate tweak tutorial on my blog If you follow it, I hope you find it useful!

like image 24
Andy Ibanez Avatar answered Nov 08 '22 21:11

Andy Ibanez