2

我正在尝试对 Cydia 的调整进行编程,并且应该在加载和隐藏视图时挂钩视图控制器类 - 我尝试了以下操作:

调整.xm:

%hook ScoresViewController

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

    self.view.hidden = YES;
}

%end

但不幸的是,当尝试使用 THEOS “制作” Tweak 时,我得到以下信息:

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

我会感谢你的帮助。我还想了解如何访问自定义类的 ivars(即:ScoresViewController)。

4

1 回答 1

3

没有任何东西告诉编译器 ScoresViewController 是 UIViewController 的后代。你可以在这里做几件事。

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

或者

@interface ScoresViewController : UIViewController @end
...
self.view.hidden = YES;
于 2012-12-20T20:12:39.063 回答