【问题标题】:cycript TypeError("undefined is not an object when following tutorialcycript TypeError("undefined is not an object when following tutorial
【发布时间】:2017-02-19 23:37:04
【问题描述】:

我正在尝试学习本教程 - http://resources.infosecinstitute.com/ios-application-security-part-8-method-swizzling-using-cycript/#article

接近文章底部,我在你输入的部分:

ViewController.messages['validateLogin'] = function() { return true;}

但我没有得到作者得到的响应,而是得到一个 TypeError

throw new TypeError("undefined is not an object (evaluating 'ViewController.messages.validateLogin=function(){return 1}')"

我正在运行 iOS 9.0.2 并拥有 Cycript 0.9.594

【问题讨论】:

    标签: ios cycript


    【解决方案1】:

    这是因为语法发生了变化。消息在 Cycript 中不再是有效的调用。而是使用 .prototype。

    ViewController.prototype.isDeviceJailbroken = function () { return false; }
    

    参考:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-15
      • 2019-03-25
      • 1970-01-01
      • 2016-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-21
      相关资源
      最近更新 更多