Method origMethod = class_getInstanceMethod(NSClassFromString(@"UIViewController"), @selector(viewDidLoad));
IMP orig_fun = method_getImplementation(origMethod);
method_setImplementation(origMethod,imp_implementationWithBlock(^(id self,SEL _cmd){
NSLog(@"target = %@",self);
NSLog(@"NSStringFromSelector(_cmd) = %@",NSStringFromSelector(_cmd));
orig_fun(self,_cmd);
}));
为啥闪退,应该怎么写才最好,替换方法后运行原来方法。