美文网首页
ios逆向工具theos tweak make编译错误Tweak

ios逆向工具theos tweak make编译错误Tweak

作者: 不安分的夏 | 来源:发表于2022-10-10 11:49 被阅读0次

self无法识别报错

在%hook 后面跟着的类名,就是self,使用self的时候的时候会报错找不到方法.例如:

Tweak.x:19:25: error: no visible @interface for 'FindFriendEntryViewController' declares the selector 'numberOfSectionsInTableView:'       
if  ( section == [self numberOfSectionsInTableView:tableView ] - 1 ){                         
~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Tweak.x:33:37: error: no visible @interface for 'FindFriendEntryViewController' declares the selector 'numberOfSectionsInTableView:'       if  ( [indexPath section] != [self numberOfSectionsInTableView:tableView ] - 1 ){                                 
   ~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Tweak.x:43:37: error: no visible @interface for 'FindFriendEntryViewController' declares the selector 'numberOfSectionsInTableView:'        if  ( [indexPath section] != [self numberOfSectionsInTableView:tableView ] - 1 ){                                     
 ~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~

解决方法:

方法1:声明self是什么类,在里面加上方法名,如下:

@interface FindFriendEntryViewController

- (long long)numberOfSectionsInTableView:(id)arg1;

@end

方法2:声明这个类,并且说明他遵守哪个协议,因为上面的numberOfSectionsInTableView是在协议UITableViewDataSource里定义的,所以声明self的类遵守了哪个协议,就代表里面有哪些方法.

@interface FindFriendEntryViewController<UITableViewDataSource>

@end

链接错误找不到UIKit里的定义的变量或者类

报错如下

解决方法:

在Tweak.x文件中 %hook之前添加

#import <UIKit/UIKit.h>

在Makefile里面加入一行:

项目名_FRAMEWORKS = UIKit

例如:下面是一个项目名叫tingweak的Makefile文件,注意最后一行tingweak_FRAMEWORKS = UIKit

TWEAK_NAME = tingweak

tingweak_FRAMEWORKS = UIKit

参考来自 https://blog.csdn.net/boildoctor/article/details/122843676
我自己主要只遇到了第二个问题 
此文档只用于记录,以防后面遇到同样问题方便解决

相关文章

网友评论

      本文标题:ios逆向工具theos tweak make编译错误Tweak

      本文链接:https://www.haomeiwen.com/subject/alnaartx.html