获取OC 实现部分 IMP
- 通过method 去获取,这里只获取了实例方法的IMP
1
2
3
4
5
6
7
8
9
10
struct objc_method2{
SEL method_name ; // 方法名
char *method_types ;
IMP method_imp ; // 方法实现
};
typedef struct objc_method2 *Method2;
Method2 method = (Method2)class_getInstanceMethod(%c(SmCoreCollector),@selector(collect));
NSLog(@"--Method2--:%@---%s---%lu",NSStringFromSelector(method->method_name),method->method_types,method->method_imp); - 通过 class_getMethodImplementation 获取
1 |
|