Aspects
Aspects copied to clipboard
this is a resolution to support hook static method
-
get meta-Class from class :
Class cls = object_getClass(self.class); -
hook: [cls aspect_hookSelector:selector withOptions:options usingBlock:block error:error];
!!!!!!!
Nice work @Assuner-Lee , I can confirm this works! I used it to swizzle:
[MFMailComposeViewController canSendMail]
Been looking for this for awhile!
@Assuner-Lee @varun531 If had hooked a static method using the above method, then you try to hook a instance method and call the instance method, it would be crashed!
May you can also try Stinger https://github.com/eleme/Stinger
@Assuner-Lee @varun531 If had hooked a static method using the above method, then you try to hook a instance method and call the instance method, it would be crashed!
May you can also try Stinger https://github.com/eleme/Stinger