简体   繁体   中英

cycript TypeError("undefined is not an object when following tutorial

I am attempting to follow this tutorial - http://resources.infosecinstitute.com/ios-application-security-part-8-method-swizzling-using-cycript/#article

Close to the bottom of the article, I am at the part where you type:

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

but I don't get the response that the author gets, instead I get a TypeError

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

I am running iOS 9.0.2 and have Cycript 0.9.594

This is because the syntax is changed. messages is no longer valid call in Cycript. Instead use .prototype.

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

Reference:

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM