lldb
<__NSStackBlock__: 0x16f80ec60>
<NSMethodSignature: 0x280c89320>
number of arguments = 3
frame size = 224
is special struct return? NO
return value: -------- -------- -------- --------
type encoding (v) 'v'
flags {}
modifiers {}
frame {offset = 0, offset adjust = 0, size = 0, size adjust = 0}
memory {offset = 0, size = 0}
argument 0: -------- -------- -------- --------
type encoding (@) '@?'
flags {isObject, isBlock}
modifiers {}
frame {offset = 0, offset adjust = 0, size = 8, size adjust = 0}
memory {offset = 0, size = 8}
argument 1: -------- -------- -------- --------
type encoding (B) 'B'
flags {}
modifiers {}
frame {offset = 8, offset adjust = 0, size = 8, size adjust = -7}
memory {offset = 0, size = 1}
argument 2: -------- -------- -------- --------
type encoding (@) '@'
flags {isObject}
modifiers {}
frame {offset = 16, offset adjust = 0, size = 8, size adjust = 0}
memory {offset = 0, size = 8}
我理解是无返回值,一个BOOL和一个id型参数
-(void)method1:(id)arg1 method2:(id)arg2 method3:(id)arg3 method4:(void(^)(BOOL,id))arg4 {
NSLog(@"MyHook1 \narg1:%@\narg2:%@\narg3:%@\narg4:%@\n",arg1,arg2,arg3,arg4);
id myArg4 = ^(BOOL block_arg1, id block_arg2){
NSLog(@"MyHook2 %@",block_arg2);
arg4(block_arg1,block_arg2);
NSLog(@"MyHook3 arg4 completed");
};
%orig(arg1,arg2,arg3,myArg4);
}
输出MyHook1 和 MyHook2就crash,这个hook应该怎样写呢?block还是没全搞懂
https://github.com/AloneMonkey/MonkeyDev/issues/125 和这个例子一模一样,而且我还试着try/catch, 以为有什么exception,没有任何输出,直接闪退/crash
难道上面的参数不对?
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!
最后于 2022-11-28 08:21
被llau编辑
,原因: 调整格式