Good day!
Today I would like to revisit the development of jailbreak programs for iOS. In the Russian-language Internet it is quite problematic to find something understandable to beginners, so I will try to correct this misunderstanding and explain how some points are solved.
Installing the software, setting up the environment and the device, writing tweaks from scratch - this is what awaits you under the cut. If you're wondering how to change the part of iOS for yourself - welcome.
Let's start!
What do we need?
- Computer running Mac OS X with git, dpkg utilities;
- Xcode with Command Line tools installed (I use 5.1.1, however, 4.0+ is suitable);
- Theos ;
- Package iOSOpenDev ;
- Device with jailbreak and OpenSSH installed.
Training
The first step is to install Xcode. You can download it from the Mac AppStore, as well as from the download page on the Apple website. I will not dwell on this in detail.
')
Next you need to put theos. We are told that it can be crammed onto any platform, and it will work, but today we
don’t reinvent the wheel doing everything on the iOS SDK system.
Download theos to the / opt / theos folder. You can put in any folder, but at your own risk:
export THEOS=/opt/theos git clone git://github.com/DHowett/theos.git $THEOS
This completes theos setup.
Download iOSOpenDev and run the installer. He will do everything for you.
In the case of an unknown error, the application is most likely called not “Xcode.app” or you did not launch it at all.The freebie is over. Time setting variables.
Open ~ / .bash_profile and edit the following lines:
export iOSOpenDevDevice=...
Now iOSOpenDev will know the IP of your device, all that remains is to allow SSH connection without asking for a password and download all the necessary database of libraries:
iod-setup base iosod sshkey -h <IP >
Twice we enter the device password, and if requested, we create a password for keychain.
Moreover, you need to download a
pack of headers and put in / opt / iOSOpenDev / include.
This is the hardest thing with IOSurfaceAPI.h, since it is not freely distributable code. But if you can’t get it out of the system (on Mac OS X 10.10 I didn’t find it), then take the “plug” out of the _fallback folder, and it will be enough for our analysis.
At this installation can be considered complete.
We write the basis
All development will take place in Xcode, although with some limitations.
Create a new project and meet the new item “iOSOpenDev”.

We need Logos Tweak:

We fill out information about the project. Include Simple PreferenceLoader will add to the project a simple settings block in Settings.app. But about it later.
Now we have to do what Xcode itself does not do - add UIKit.framework and libsubstrate.dylib to the list for linkovshik (the latter is in / opt / iOSOpenDev / lib /).

After that we go into our .xm file, we demolish the directive #error and click on the assembly. The first build will fail, and the second should be successful, this is normal. Even in the xm file there is no syntax highlighting, but this is solved by closing and opening Xcode after the first build.
Dot all “i”: the .xm file is responsible for the tweak code, and the .mm file is “intermediate”, it is automatically generated by the logos preprocessor and then compiled.
The first steps
Today we will change the dull inscription "Unlock" the lock screen with your text.
Firstly, it would be good to get the header of the "experimental" binary. With SpringBoard everything is much simpler - people are ready to
lay out springboard headboards for each version of iOS. But if you want to make them yourself, then the class-dump-z utility will help you with this.
I am writing for iPad 4 on iOS 8.1, so we are looking at the corresponding leaders.
There are two ways to quickly find what we need. The first is to use cycript and look at the hierarchy of objects to find what you need. The second is to search by the contents of the headers. In this case, I decided to search for the request “unlockText” and found the following method in the SBLockScreenView class:
- (id)_defaultSlideToUnlockText;
Suppose that is what we need. We write the first sketch:
#import <UIKit/UIKit.h> %hook SBLockScreenView - (id)_defaultSlideToUnlockText { return @", !"; } %end
To compile with the installation on the device, select Build for profiling:

And, oh, a miracle! Surprisingly, everything worked the first time:

Our main goal is to make the text change, so we will create a constructor (% ctor) and load the settings.
#import <UIKit/UIKit.h> #define SETTINGS_FILE @"/var/mobile/Library/Preferences/ru.firemoon777.LockLabel8Bundle.plist" NSDictionary *settings; %hook SBLockScreenView - (id)_defaultSlideToUnlockText { return [settings objectForKey:@"Text"]; } %end static void loadSettings() { settings = [[NSDictionary alloc] initWithContentsOfFile:SETTINGS_FILE]; } %ctor { loadSettings(); }
Create a settings panel
Create a new target: File - New - Target - iOS Open Dev - PreferenceBundle; Let's call it LockLabel8Bundle.
There is a big plus of the project with “complex” PreferenceBundle - in the settings you can make the entire graphical interface for the application and do not bother with starting from the root and signatures. But there is also a minus - the panel in the settings and the tweak itself is collected in separate packages, so for the release you will have to combine them as well.
You can try to build a template and admire the many possible built-in PSSpecifiers.
Perhaps it does not immediately accumulate. So you missed the download of headlines, about which I spoke at the beginning of the article.
Of all, I will leave only the first and last group, TextView and one button.

You can also edit the “label” field so as not to shine with this “Bundle”.
The button has an Action “respring:”, therefore we will describe the respring method in LockLabel8BundleController:
- (void)respring:(PSSpecifier*)specifier { system("killall SpringBoard"); }
With the development inside the settings, everything is much simpler: the same laws apply here as in ordinary applications.
Source code is available on
github .
Support for multiple versions of iOS?
When a tweak becomes a large-scale project from a simple draft, the question arises, how to organize support for several versions of iOS so that nothing extra is downloaded? Here come to the aid of the group.
%group iOS6
Summarize
iOSOpenDev is just a plugin for Xcode, but, in my opinion, it is much simpler and more convenient than the “bare” theos. On Mac OS X, it makes it much easier to develop iOS tweaks for beginners.