Under The BridgeUnder The Bridge

iPhone Wax

And today, we’re going to tell you how to make your iPhone extra-shiny!

No, actually, “iPhone Wax” is an oddly-named project that lets you write native apps in Lua, of all things.

I started investigating how I might wire up — and then write native iPhone apps from — a scripting language. Lua was on my radar already. It’s compact, expressive, fast enough, and was designed to be embedded. Took only about 20 minutes to get the Lua interpreter running on the iPhone. The real work was to bridge Lua and all the Objective-C/CocoaTouch classes. The bridge had to work in two directions: it would need to be able to create CocoaTouch objects and also be able to respond to callbacks as part of the familiar delegate/protocol model.

I tweeted about my intentions. Corey Johnson responded that he’d been working along the same lines and, dang-it, his implementation was exactly what I had in mind. It’s called iPhone Wax, it’s brilliant, and Apple has already approved one app using it.

Intriguing? If so, read the above article, check out the code on github, a sample on github, and the Google group.

Now, there is some fuzziness about what exactly the status is of interpreted scripts for App Store acceptability purposes. Downloading scripts to extend application functionality is pretty clearly out of bounds, but it’s not completely clear whether scripts bundled in your application are officially acceptable or not — and if not, whether using Lua’s bytecode interpreter for semi-compiled scripts avoids that line. But hey, one slipped through at least … if it’s still on the store by the time you’re reading this, apparently you can get away with it!

LinkShare analytics

So as a conscientious IPhone developer, no doubt you signed up to be an iTunes affiliate to get that extra 5% on your upgrades and all as we described here, but as you’ve probably noticed, there’s a definite dearth of feedback through LinkShare on where exactly all those monthly megabucks (well, in our case it’s decabucks, but we trust you’re putting more effort into it than we’ve bothered so far) are coming from. Wouldn’t it be great if there was some way to track exactly which clicked link resulted in what kickbacks?

Well, turns out there is a really complicated super secret way to manage that. And here it is:

All you really need to do is add a ‘&u1=<your_custom_signature>’ to the end of the url.

OK, so it’s not that really complicated.

It’s not all that super secret either, actually … more like hidden in plain sight from those that don’t bother looking around much. The trick is to find the LinkShare Affiliate Resource Center and click on LinkShare Signature Technology, which gives you a document to fill out to request that they turn on this signature tracking for your account — [EDIT: And when you do, you get an email back the next day telling you “Please note that all affiliates are enabled for the LinkShare Signature Technology. Thus, you no longer need to submit us that form.” Apparently website currency is not a high priority at LinkShare… ] — and a PDF of instructions on how to use it and access the reports. Which pretty much boils down to the quote above.

So there you go; built-in analytics with your LinkShare referrals!


GeoRiot (now GeniusLink) promises to internationalize all your links

Opening GeoRiot Affiliate Link from Inside App? discusses avoiding Safari opening.

Afflr.com is another localization option.

User Friendly iTunes Affiliate Links — use any iTunes URL, but lose signature tracking

Automatically Track App Sale Referrals — download redirection for reviewer links

iTunes API for GIfting, not just Searching?

Implementing Smart App Banners — they use affiliate IDs too!

adeven/AEProductController: “Small wrapper for SKStoreProductViewController that handles affiliate links.”

Simple Unit Testing

So you read our earlier post on unit testing but haven’t gotten around to actually setting it up yet? Well, here’s a simpler way to dip your toes into the water:

One of the biggest gripes that folks have about the built in unit testing for Xcode is that it’s a pain to setup and debug. I’ve also hear from folks that this is the reason they don’t write tests, which is a shame. But I’m going to share a little secret with you today: thanks to Objective-C, it’s pretty darn easy to roll your own solution.

Here’s some code for you: CallTestMethods.m

I’ve even got it hooked up to my build process these days; I launch Acorn from my build script with a -runtests argument, and away it goes. I’m not sure how much easier it could be. It’s very low friction and easy to debug, which is important to me.

Ah, yes. It’s all about the low friction, isn’t it?

Tip: className

So you got some desktop Cocoa code to port that does some introspection, like

if ([[args className] isEqualToString:@"NSCFBoolean"])

and you noticed — whoops! — that -className doesn’t exist in the iPhone SDK, for no apparent reason other than to confuse you?

Well, no, neither did we until today. But if/when you do … here’s the trick to faking it yourself:

Now you know!

Code: Appirater

Here’s another option to deal with the problem of negative review bias in the App Store by asking your frequent users to post for you: Appirater!

Now every time the user launches your app, Appirater will see if they’ve used the app for 30 days and launched it at least 15 times. If they have, they’ll be asked to rate the app, and then be taken to your app’s review page in the App Store. If you release a new version of your app, Appirater will again wait until the new version has been used 15 times for 30 days and then prompt the user again for another review. Optionally, you can adjust the days to wait and the launch number…

So that looks like a rather simpler alternative to the previously mentioned L0SolicitReview for accomplishing your begging. Code is here on github; enjoy!

h/t: iPhoneSDK!


UrbanApps / UAAppReviewManager: New Library For Getting More App Reviews Featuring Dynamic Prompts, Localization And More

Building HTML Apps

[EDIT: Discontinued.]

So we’ve mentioned favorably before that using HTML5 to build iPhone apps is an interesting looking alternative, but there’s been a dearth of public information targeted specifically at that. Well, now there is! Over at O’Reilly Labs they’ve published

Building iPhone Apps with HTML, CSS, and JavaScript

Now web designers and developers can join the iPhone app party without having to learn Cocoa’s Objective-C programming language. It’s true: You can write iPhone apps quickly and efficiently using your existing skills with HTML, CSS, and JavaScript. This book shows you how with lots of detailed examples, step-by-step instructions, and hands-on exercises.

  • Learn how to build iPhone apps with standard web tools
  • Refactor a traditional website into an iPhone web app
  • Hook into advanced iPhone features (e.g. accelerometer, geolocation, vibration, and sound) with JavaScript
  • Do most of your development with the operating system of your choice

Yes, we’ve definitely got that on the reading list. Just as soon as there’s a spare minute around here…

h/t: DZone!

New releases

Looks like October’s a big deadline date all around: we’ve got a veritable plethora (ok, three) of new releases that all came to our attention today!


Zennaware Cornerstone which we’d already designated the best SCM client EVAR jumps to version 1.5, with a laundry list of new features and interface improvements — go click and read it yourself, it’s very long indeed — but we’d like to note that we particularly appreciate how the 22 working copies it’s tracking for us (yes, it’s been busy around here since we first started using it…) which were taking just enough seconds to synchronize at startup to border on mildly annoying, are now instant. Yes, instant. FSEvents rock. If you’re using any other SVN client, you really should check Cornerstone out. If there’s any reason left to use any other Mac client, we sure can’t see what it could conceivably be.


Vimov iSimulate which we’d concluded was pretty darn handy for hooking up the Simulator and device input is now version 1.1, and get this, they’ve added screen streaming:

While your application is running on the iPhone Simulator, whether it is a UIKit-based application or an OpenGL game, iSimulate will stream it as a video to your iPhone or iPod Touch in realtime, so that you can more easily move your fingers across the screen, and accurately touch the buttons and controls.

We actually hadn’t found lacking that as much of a problem as you’d think — but hey it’s great to have! Also adds orientation change notification and customizable touch indicators. So yep, for the $32 it’s up to know, we’d call that a pretty compelling addition to your bag of development tricks, yep.


Graphic Remedy’s gDEBugger which we’d sized up as vital if you do low level OpenGL is now officially released and up to speed with SDK 3.1 and OpenGL ES 2.0, at an introductory $550 price. Still a bit pricey, we grant you … but hey if you are doing any hardcore OpenGL work, there’s just no other way to get this kind of information and it’s going to pay for itself right quick.

Why, it’s just like Christmas with all these new toys to play with!

Tip: Xcode function marks

Here’s a handy tip for all you non-C-based-language Xcode users out there; if you wished that you could have helpful comments in your function popup lists like C-based languages do with

it turns out that, as a matter of fact, that capability is built into the Xcode editor! In C-based languages, any comment line that starts with

will insert the commented text in the popup just as if you’d typed out #pragma mark. Which saves a few keystrokes, whoopie; however, apparently the same trick also works for native comments in Java, Perl, Python, and Ruby! Helpful little convention to adopt, then, we believe we’ll start doing that everywhere.

Review: Things

OK, this isn’t a “review” really, just a flat out recommendation — buy Things for the Mac and Things for the iPhone, they’ll improve your life.

As you can probably imagine even if you’re not one, being a freelance contractor, and particularly a freelance contract iPhone programmer, involves juggling a vast array of conflicting projects, usually running at least three levels of interrupt deep. And although over the years we’ve dabbled at many, many forms of online and offline organization, most popularly these days some kind of derivation of the GTD™ cult, they’ve all ended up in short order being either too unwieldy to be actually useful, too structure-imposing to actually match the real world, or too consumed on process as a substitute for actual achievement … and we end up actually using the good ol’ Stuff To Do piece of scrap paper tucked under the keyboard.

Until now!

We’d been noticing rave reviews of the simplicty of Things popping up all over the web but the goodies list here was the one that finally roused us enough to figure hey, if the desktop and iPhone versions actually worked well together, this could finally be one that was worth the effort to get into. And shocked, shocked we were to find that it not only had a learning curve approximating zero, it was actually less overhead than paper. Six days into running it now, and it’s completely taken over running our life, as it works just the way we do … but easier. Amazing, that.

The only thing that comes close to a flaw is that we’d like to see MobileMe (or whatever) sync so that our various computers, iPhones, and iPods could all share state through the cloud with complete transparency. But hey, even without that, it’s still the best — nay, the first and the only — personal task-management software that actually helps us manage tasks as opposed to having us fiddle with managing tasks. Matter of fact, it’s pretty much verging on killer app status for the iPhone platform, that’s how good we think it is … and if your life is anywhere near as unavoidably unstructured as ours, we’re pretty sure that you’ll agree!


So if you bothered reading that last post about lickety-split XML parsing, you might have noticed the references in the referring article to “the Tiled map editor” which apparently was the producer of the XML in question. That didn’t perk our interest quite enough to track it down … but turns out there’s a companion post that makes the noteworthiness of Tiled, a generic tile map editor quite clear:

Tiled is a general purpose tile map editor. It’s built to be easy to use, yet capable of catering to a host of varying game engines, whether your game is an RPG, platformer or Breakout clone. Tiled supports plugins to read and write map formats, in addition to its map format, to support map formats in use by engines.

Not quite seeing the noteworthiness yet? Well, here you go. As you may recall, we’re fans of the cocos2d library around here, but we’d managed to overlook recent developments; turns out that as of v0.8.1 back at the end of August, support for Tiled maps is baked in for orthogonal and isometric maps! As writing your design tools and designing their data formats takes up a huge chunk of game development effort, anything that speeds that along is A Good Thing; and it certainly does seem that between cocos2d, the Tiled editor, and TBXML to speedy things up, you’ve got a pretty sweet open source game development environment taking shape here, doesn’t it?