Quantcast
Channel: 睿论坛 - 最新话题
Viewing all articles
Browse latest Browse all 5732

想打印hook到的参数

$
0
0

@a906335708 wrote:

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);
这个方法用的有问题么?

Posts: 3

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5732

Trending Articles