Wax is Lua for Cocoa Touch

Tuesday, November 17, 2009

You should check out Wax! I haven't really used it yet but I've installed it, compiled the example, and looked at the code, and from what I've seen it looks pretty amazing in how it bridges between Lua and the Objective-C runtime. Both wax and Lua are incredibly small/fast. There's more tutorial type stuff at MobileOrchard.

Building IPA (iPhone Application) Files with Xcode

Monday, November 16, 2009

If you've sent an ad-hoc application bundle distribution to any Windows users then most likely one of them has been a little confused by it. This is because Mac application bundles receive no special treatment on windows and instead appear as a folder of other folders, and if you don't dig down to the right level in the hierarchy and drag the right folder into iTunes then iTunes doesn't install the application.

The way to avoid this is to build an IPA file which is the format that iTunes on both OS X and Windows store downloaded applications in. Basically the format is just a zip file with a specific directory structure and an ".ipa" extension instead of the normal ".zip" extension. Since it's just a single file whether you're using a Mac or Windows, it makes everything equally simple for everyone.

So it's not too hard to create an IPA file, but Xcode won't do it for you by default or using any built-in target templates. Luckily it's not that hard to get it to work.

A guy posted some instructions here on how to do this, but his build script was a little too hard-coded for me, so I improved on it a bit:
payload_dir="$CONFIGURATION_BUILD_DIR/Payload"
app_bundle_dir="$CONFIGURATION_BUILD_DIR/${PROJECT_NAME}.app"

/bin/rm -rf "$payload_dir"
/bin/mkdir "$payload_dir"
/bin/cp -R "$app_bundle_dir" "$payload_dir"
/bin/cp iTunesArtwork "$CONFIGURATION_BUILD_DIR/iTunesArtwork"
cd "$CONFIGURATION_BUILD_DIR"

/usr/bin/zip -r "${PROJECT_NAME}.ipa" Payload iTunesArtwork
rm -rf "$payload_dir" iTunesArtwork
These modifications allow you to just copy the script into any project without having to modify the script with the project name and such. Otherwise just follow his instructions.

You may also want to add the input and output files to support the dependency freshness checking stuff in the build system. This helps to ensure that a new IPA file doesn't get built from an old application bundle.