再使用 theos 的 logify 工具,该工具用来注入NSLog来打印方法的入参和出参。(就是在所有的方法里面加 log)
logify.pl ~/Document/headers/SayHelloViewController.h > ~/Desktop/Tweak.xm
注意:一般该Tweak.xm仍然无法执行,需要进行修改:
去掉.cxx_destruct 方法
将HBLogDebug 改为NSLog
去掉所有的delegate
将所有的参数对象类型改成id
去掉所有的weak
下面是生成的文件
不过我去改。改完后 去make 报一堆错误。。估计是我不会改。。 有大大教下怎么改么
%hook WCAccountLoginFirstViewController
- (void).cxx_destruct { %log; %orig; }
- (void)didRotateFromInterfaceOrientation:(long long)arg1 { %log; %orig; }
- (void)willAnimateRotationToInterfaceOrientation:(long long)arg1 duration:(double)arg2 { %log; %orig; }
- (void)onChangeLanguage { %log; %orig; }
- (void)initView { %log; %orig; }
- (id)getBackgroundImgWithOrientation:(long long)arg1 { %log; id r = %orig; HBLogDebug(@" = %@", r); return r; }
- (void)adjustTableViewRect { %log; %orig; }
- (void)adjustViewAndNavBarRect { %log; %orig; }
- (double)getVisibleHeight { %log; double r = %orig; HBLogDebug(@" = %f", r); return r; }
- (void)updateChangeLanguageBtn { %log; %orig; }
- (void)setDelegate:(id)arg1 { %log; %orig; }
- (void)onLanguageChange { %log; %orig; }
- (id)init { %log; id r = %orig; HBLogDebug(@" = %@", r); return r; }
- (void)dealloc { %log; %orig; }
- (NSString *)debugDescription { %log; NSString * r = %orig; HBLogDebug(@" = %@", r); return r; }
- (NSString *)description { %log; NSString * r = %orig; HBLogDebug(@" = %@", r); return r; }
- (unsigned long long )hash { %log; unsigned long long r = %orig; HBLogDebug(@" = %llu", r); return r; }
- (Class )superclass { %log; Class r = %orig; HBLogDebug(@" = %@", r); return r; }
%end