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:")
      
    • 完整代码详见

results matching ""

    No results matching ""