hook了自己写的app的 didSelectRowAtIndexPath 方法,打印indexpath
%hook MessageChatListViewController
- (void)tableView:(id)arg1 didSelectRowAtIndexPath:(id)arg2{
Ivar indexPathIvar = class_getInstanceVariable([arg2 class], “indexPath”);
id indexPath= object_getIvar(arg2, indexPathIvar);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@“didSelectRowAtIndexPath” message:[NSString stringWithFormat:@“indexpath.row = %ld”,[indexPath row]] delegate:self cancelButtonTitle:@“OK” otherButtonTitles:nil];
[alert show];
//%orig;
}
%end
但是点击cell后 能hook这方法 但是每次打印出来都是null,
Ivar indexPathIvar = class_getInstanceVariable([arg2 class], “indexPath”);
id indexPath= object_getIvar(arg2, indexPathIvar);
这个方法用的有问题么?