#import <substrate.h> // necessary
#import <Foundation/Foundation.h>
@interface TheClassYouAreHooking : NSObject {
NSString *_exampleVariable;
}
- (void)doSomething;
@end
NSString *_exampleVariableHooked;
%hook TheClassYouAreHooking
- (void)doSomething
{
// 'Hook' the variable
exampleVariableHooked = MSHookIvar<NSString *>(self, "_exampleVariable");
exampleVariableHooked = @"Hello World";
}
%end
MSHookIvar 还能hook BOOL floats 等 .
exampleVariableHooked = MSHookIvar<BOOL>(self, "_someBOOL");
网友评论