获取某一个class的私有Api

//知道怎么用私有api,要怎么获得

        //要导入#import <objc/runtime.h>

        NSString *className = NSStringFromClass([UIView class]);

        //这里是uiview,可以改成自己想要的

        

        const char *cClassName = [className UTF8String];

        

        id theClass = objc_getClass(cClassName);

        

        unsigned int outCount;

        

扫描二维码关注公众号,回复: 584434 查看本文章

        Method *m =  class_copyMethodList(theClass,&outCount);

        

        NSLog(@"%d",outCount);

        for (int i = 0; i<outCount; i++) {

            SEL a = method_getName(*(m+i));

            NSString *sn = NSStringFromSelector(a);

            NSLog(@"%@",sn);

            

        }

猜你喜欢

转载自374016526.iteye.com/blog/2054583