2

I'm trying to program a Cydia's tweak and should hook a viewcontroller class while loading and hide the view - i've tried the following:

Tweak.xm:

%hook ScoresViewController

- (void)viewWillAppear:(BOOL)fp8 {
    %orig;

    self.view.hidden = YES;
}

%end

but unfortunately, when trying to "make" the Tweak using THEOS , i get the following:

Making all for tweak scoresenhancer...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
Tweak.xm: In function 'void       _logos_method$_ungrouped$ScoresViewController$viewWillAppear$(ScoresViewController*, objc_selector*, BOOL)':
Tweak.xm:49: error: request for member 'view' in 'self', which is of non-class type 'ScoresViewController*'
Tweak.xm: In function 'void _logos_method$_ungrouped$ScoresViewController$viewWillAppear$(ScoresViewController*, objc_selector*, BOOL)':
Tweak.xm:49: error: request for member 'view' in 'self', which is of non-class type 'ScoresViewController*'
lipo: can't figure out the architecture type of: /var/tmp//ccFsVzMR.out
make[2]: *** [obj/Tweak.xm.o] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [scoresenhancer.all.tweak.variables] Error 2

I will appreciate your assistance. I will also would like to understand how can I reach ivars of the customized class (i.e: ScoresViewController).

AndyG
  • 39,700
  • 8
  • 109
  • 143

1 Answers1

3

There is nothing there telling the compiler that ScoresViewController is a UIViewController descendant. There are a couple things you could do here.

[(UIViewController *)self view].hidden = YES;

or

@interface ScoresViewController : UIViewController @end
...
self.view.hidden = YES;
Dustin Howett
  • 1,635
  • 11
  • 13