Giter Site home page Giter Site logo

bigbang's Introduction

BigBang

性能损耗

状态        平均耗时       次数
不加之前 0.000213s 20000次
函数副本方法     0.000579s     20000次
存IMP指针方法    0.000587s     20000次

不同设备之间会存在差异

函数副本方法:

所有方法都加上 BigBang_前缀 副本方法IMP指针使用原方法的

存IMP指针方法

将IMP指针转成long 存入字典中

        //缓存
        _IMP imp = method_getImplementation(method);
        
        NSNumber *pNumber = [NSNumber numberWithLong:(long)imp];
        
        [impDict setObject:pNumber forKey:NSStringFromSelector(methodSel)];
        
        //使用
        NSNumber *pNumber = [impDict objectForKey:NSStringFromSelector(invocation.selector)];
        
        long *p = (long *)[pNumber longValue];
        
        _IMP imp = (_IMP)p;
        
        [invocation invokeUsingIMP:imp];

勾某个类的所有方法的,查看所有方法的执行顺序

使用方法

[BigBang hookClass:@"A_ManageViewController"];

常规使用:

放在只执行一次的函数里,防止多次勾一个函数 如

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

hook:

attribute((constructor)) static void entry()

放这里面

打日志的printf 改成 nslog

在终端那个应用里面就能看到日志

avatar  

微信

[BigBang hookClass:@"WCPayLogicMgr"];

[BigBang hookClass:@"WCRedEnvelopesLogicMgr"];

[BigBang hookClass:@"ContactUpdateHelper"];

[BigBang hookClass:@"WCRedEnvelopesNetworkHelper"];

[BigBang hookClass:@"WCRedEnvelopesReceiveHomeView"]

avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.