未声明的标识符' MSHookIvar'

时间:2016-01-05 15:04:34

标签: ios objective-c cygwin theos cydia-substrate

导入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的定义,我该怎么办?

请帮忙

1 个答案:

答案 0 :(得分:0)

我从googlecode用户networkpx找到了substrate.h Link

我用现有的替换它,似乎编译和完美工作