Microsoft Word - iOSAppReverseEngineering.docx

(Romina) #1
NSLog(@"This class & method only exist in iOS 7.");
return result;
}
%end
%end // iOS7Hook

%group iOS8Hook
%hook iOS8Class


  • (id)iOS8Method
    {
    id result = %orig;
    NSLog(@"This class & method only exist in iOS 8.");
    return result;
    }
    %end
    %end // iOS8Hook


%hook SpringBoard


  • (void)powerDown
    {
    %orig;
    }
    %end


Inside %group iOS7Hook, it hooks [iOS7Class iOS7Method]; inside %group iOS8Hook, it


hooks [iOS8Class iOS8Method]; and inside % group _ungrouped, it hooks [SpringBoard


powerDown]. Can you get it?


Notice, %group will only work with %init.


² %init


This directive is used for %group initialization; it must be called inside %hook or %ctor. If a


group name is specified, it will initialize %group SpecifiedGroupName, or it will initialize


%group _ungrouped, for example:


#ifndef kCFCoreFoundationVersionNumber_iOS_8_0
#define kCFCoreFoundationVersionNumber_iOS_8_0 1140.10
#endif

%hook SpringBoard


  • (void)applicationDidFinishLaunching:(id)application
    {
    %orig;


%init; // Equals to %init(_ungrouped)
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0 &&
kCFCoreFoundationVersionNumber <
kCFCoreFoundationVersionNumber_iOS_8_0) %init(iOS7Hook);
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0)
init(iOS8Hook);
}
%end
Please remember, a %group will only take effect with a corresponding %init.
Free download pdf