Objective-C related iOS reverse engineering
Objective-C is a typical object-oriented programming language and most developers are
surely proficient with its basic usage. Using Objective-C in the introductory phase of iOS reverse
engineering can help us get a smooth transition from App development to reverse engineering.
Fortunately, the file format used in iOS is Mach-O and it consists of enough raw data for us to
restore the headers of binaries through class-dump or some other tools. With this information,
we can start reverse engineering from the level of Objective-C, and writing tweaks is
undoubtedly the most popular amusement at this stage. So let’s start from writing tweaks.
5.1 How does a tweak work in Objective-C
When talking about Theos in chapter 3, we have introduced the concept of tweak already.
From wikipedia, the definition of tweak is tools for fine-tuning or adjusting a complex system,
usually an electronic device. In iOS, tweaks refer to dylibs that can be used for enhancing the
capabilities of other processes and they’re the most important part in jailbroken iOS.
Because of tweaks, jailbreak users can customize iOS based on their own preferences. Also,
with tweak, developers are able to enrich the functionalities of other great software. All these
facilities cannot be satisfied within the non-jailbroken iOS and AppStore. Almost all popular
software in Cydia are various creative tweaks (A tweak icon is shown in figure 5-1), such as
Activator, Barrel, SwipeSelection, etc. Generally speaking, the core of a tweak is a variety of
hooks and most hooks target Objective-C methods. So how does a tweak work in Objective-C?
Figure 5- 1 Tweak icon
Objective-C is a typical object-oriented programming language; iOS consists of many small
5