TypeError: cannot read property 'implementation' of undefined
- 问题:
写frida的hook代码调试ObjC的函数
function hook_specific_method_of_class(className, funcName)
{
var hook = ObjC.classes[className][funcName];
Interceptor.attach(hook.implementation, {
onEnter: function(args) {
console.log("[*] Detected call to: " + className + " -> " + funcName);
}
});
}
//Your class name and function name here
hook_specific_method_of_class("AAUISignInViewController", "_nextButtonSelected:")
始终报错:
TypeError: cannot read property 'implementation' of undefined
- 原因:此处iOS的ObjC的函数名
_nextButtonSelected:
写法有误 - 解决办法:改为正确的写法:
- _nextButtonSelected:
- 注:此处的ObjC的类的函数名的写法:
- 加上类型是
class
的还是instance
,所对应的加号
=+
还是减号
=-
,以及中间带上空格
=
- 加上类型是
- 相关代码改动:
hook_specific_method_of_class("AAUISignInViewController", "- _nextButtonSelected:")
- 完整代码详见
- 注:此处的ObjC的类的函数名的写法: