Hi, I'm Tim

I like to dabble in all things related to programming, and occasionally I write about what I’m up to.

Cycript and NetNewsWire

Yesterday, I gave Cycript a shot. I’ve stumbled across it several times in the past, but never given it a try. I’m glad I finally did, because it is very cool!

Cycript is an interactive console that lets you modify running applications on either iOS or OS X using a weird hybrid of JavaScript and Objective-C++ syntax. It lets you call arbitrary methods on objects, find instances of a certain class (through magic), and offers tab-completion and syntax highlighting for all of this. I suggest you head over to the site to read more about it and to install it!

Anyhow, after playing with it for a while, I put together a (very) small script that removes the ads from NetNewsWire:

var adView = choose(NNWAdView)[0];
if(adView != null) {
    [adView.superview removeFromSuperview];

Note: Please don’t use this script instead of purchasing NNW.

To use it, simply launch NetNewsWire and run the script with cycript -p NetNewsWire remove_ads.cy (assuming you’ve saved the script to a file named remove_ads.cy). Observe that since Cycript injected the script into the running NetNewsWire process, the changes are lost as soon as NetNewsWire is restarted.

Even though this is a very simple script, it gives a tiny glimpse into how powerful and easy-to-use Cycript is. I’m just getting started, and plan to try it out on my iPod Touch next. Perhaps this is the first step on a road to writing my first iOS tweak.