类方法调用---
lanchc opened this issue · comments
懒虫 commented
// #import <objc/message.h>
NSString* nameClass = NSStringFromClass(AspectsViewController.class);
Class catMetal = objc_getMetaClass([nameClass UTF8String]);
[catMetal aspect_hookSelector:@selector(hello) withOptions:AspectPositionAfter usingBlock:^(id aspectInfo){
NSLog(@"hello");
} error:NULL];
xindizhiyin2014 commented
you can have a look at https://github.com/xindizhiyin2014/JKUBSAspects, it have the operation of class method hook
sayHelloox commented
// #import <objc/message.h> NSString* nameClass = NSStringFromClass(AspectsViewController.class); Class catMetal = objc_getMetaClass([nameClass UTF8String]); [catMetal aspect_hookSelector:@selector(hello) withOptions:AspectPositionAfter usingBlock:^(id aspectInfo){ NSLog(@"hello"); } error:NULL];
if use this method, you can not hook the instance method, it will crash, do you have more solution for hooking class method use Aspects lib, thanks!
xindizhiyin2014 commented
thanks,I will try later!
发自我的 iPhone
… 在 2020年1月15日,上午10:33,Assuner ***@***.***> 写道:
May you can also try Stinger https://github.com/eleme/Stinger
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Das commented
you can have a look at https://github.com/xindizhiyin2014/JKUBSAspects, it have the operation of class method hook
照抄一份加前缀有意思?