在导入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的定义,我该怎么办?
请帮帮忙
发布于 2016-01-06 23:25:29
我发现了来自googlecode用户networkpx Link的substrate.h
我用我现在的版本替换了它,它似乎可以很好地编译和工作。
https://stackoverflow.com/questions/34614817
复制相似问题