导入substrate.h
后,我继续在钩子类的函数中使用MSHookIvar
。
顺便说一句,我正在尝试从Cygwin编译。
我无法使用以下错误进行编译:
Tweak.xm:20:16: error: use of undeclared identifier 'MSHookIvar'
hookedLabel = MSHookIvar<UILabel *>(self, "_textLabel");
^
Tweak.xm:20:27: error: unexpected interface name 'UILabel': expected expression
hookedLabel = MSHookIvar<UILabel *>(self, "_textLabel");
^
Tweak.xm:20:36: error: expected expression
hookedLabel = MSHookIvar<UILabel *>(self, "_textLabel");
^
Tweak.xm:20:38: error: expression result unused [-Werror,-Wunused-value]
hookedLabel = MSHookIvar<UILabel *>(self, "_textLabel");
这是我的代码:
#import <UIKit/UIKit.h>
#import "substrate.h"
#import "logos/logos.h"
%hook DataView
UILabel *hookedLabel;
-(void)layoutSubviews {
UILongPressGestureRecognizer *lpg = [[UILongPressGestureRecognizer alloc] initWithTarget: self action:@selector(handleLongPress)];
[lpg setDelegate:self];
[lpg setMinimumPressDuration:1];
[self addGestureRecognizer:lpg];
hookedLabel = MSHookIvar<UILabel *>(self, "_textLabel");
}
%end
我尝试导入logos.h
,但它仍然没有任何帮助。
编辑:
我意识到我的substrate.h没有MSHookIvar
的定义,我该怎么办?
请帮忙