NSLog(@"You’ve pressed home button but it’s not functioning.");
}
%end
It can also be used to replace arguments of the original method, for example:
%hook SBLockScreenDateViewController
- (void)setCustomSubtitleText:(id)arg1 withColor:(id)arg2
{
%orig(@"iOS 8 App Reverse Engineering", arg2);
}
%end
The lock screen looks like figure 3-4 with the new argument:
Figure 3- 4 Hack the lock screen
Besides %hook, %log and %orig, there are other common preprocessor directives such as
%group, %init, %ctor, %new and %c.
² %group
This directive is used to group %hook directives for better code management and
conditional initialization (We’ll talk about this soon). %group must end with %end, one %group
can contain multiple %hooks, all %hooks that do not belong to user-specific groups will be
grouped into %group _ungrouped. For example:
%group iOS7Hook
%hook iOS7Class
- (id)iOS7Method
{
id result = %orig;