Quantcast
Channel: 睿论坛 - 最新话题
Viewing all articles
Browse latest Browse all 5702

Theos使用%new声明方法,在本类中调用但找不到声明的方法。

$
0
0

@mmMrz wrote:

需求: 我需要使用Theos在Tweak.xm中声明一个方法(%new)并调用

编译报错:
Tweak.xm:16:11: error: instance method ‘-helloWorld’ not found (return type
defaults to ‘id’) [-Werror,-Wobjc-method-access]
[self helloWorld];

代码:
%hook NewSettingViewController

  • (void)viewDidAppear:(BOOL)animated {
    %orig;
    [self helloWorld];
    }

%new

  • (void)helloWorld {
    NSLog(@“test”);
    }

%end

操作步骤:我就是这样正常流程声明方法并调用,编译时出错。
任何其他描述: 请问是我哪里没有设置对吗。或者调用%new方法的方式错误么?
环境: Mac 10.12.6,编译的IOS的Dylib。

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5702

Trending Articles