1

After importing substrate.h, i went on using MSHookIvar in a function from a hooked class. Btw, I am trying to compile from Cygwin. I am unable to compile with the following errors:

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");

And this is my code:

#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

I tried importing logos.h but it still doesn't help at all.

EDIT: I realized my substrate.h doesnt have a definition for MSHookIvar, what should i do?

Please do help

junyi00
  • 792
  • 3
  • 8
  • 28

1 Answers1

0

i found a substrate.h from a googlecode user networkpx Link

I replaced it with my current one and it seems to compile and work perfectly

junyi00
  • 792
  • 3
  • 8
  • 28