Under The BridgeUnder The Bridge

Musings
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!

UPDATES:

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!

SCM CLIENT:

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.

DEBUGGING/VIDEO MAKING TOOL:

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.

OPENGL PROFILING TOOL:

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!

Tiled

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?

Library: TBXML

Here’s a new tool for your iPhone bag of programming tricks: the TBXML library. Yep, an XML parser, eponymously enough; and why do we draw attention to yet another of those? Why, because

TBXML is a light-weight XML document parser written in Objective-C designed for use on Apple iPhone / iPod Touch devices. TBXML aims to provide the fastest possible XML parsing whilst utilising the fewest resources. This requirement for absolute efficiency is achieved at the expence of XML validation and modification. It is NOT possible to modify and generate valid XML from a TBXML document and NO validation is performed whatsoever whilst importing and parsing an XML document.

Well, that suits a good number of applications. As discussed on 71^2 here:

… the difference is speed is truly amazing. The TMX file I was passing was taking between 15-20 seconds and with the new parser its down to 600ms …

… It also supports gzip as well … This brought the file size down from almost 2MB to 4KB.

Yep, that’s a pretty epic win alright, multiple orders of magnitude reduction in both space and time. Not bad indeed. If you have an application with significant static data requirements, this looks like a mighty compelling approach!

iPhone OpenSSL

So if you have any desktop code that involves secure communications, chances are pretty darn good that it involves the OpenSSL library. And when you begin to port said code that involves secure communications to the iPhone, you promptly find … it’s not there! At least, for a value of “not there” which is “not exposed in the official SDK”. Issues with encryption export, it seems; apparently Apple’s own apps using encryption on the phone doesn’t cover third party apps? Or something. But for whatever reason, it’s not there, and you have to build your own. And here we have some help for you with that:

Tutorial: How To Compile OpenSSL for the iPhone

Walks you through getting the source, sorting out iPhone architecture settings, and building it. Or, if you have a troll’s attitude to work, skip straight to the last paragraph:

Some people had some questions about how to use the libraries in an Xcode project. Here is a simple xcode project including just the linking of the libraries and adding of the header files: openssl_tutorial

For the lazy people. Compiled libraries: compiled_libraries

Although his nomenclature needs a little bit of work. It’s not about being “lazy”. It’s about being efficient. Although, granted, the line can be fine indeed.

As an alternative, if you’d like to integrate it into your Xcode build process, check out

Tutorial: iPhone SQLite Encryption With SQLCipher

which includes the aside

OpenSSL can be a tricky system to compile properly from source. It’s even more complex when you’re dealing with multiple target architectures, targeting i386 for the simulator but armv6 for a device. Luckily we’ve built a handy XCode project template to make it easy called openssl-xcode. The project actually relies on the OpenSSL configure and make system to build the libraries. However, it automatically detects the appropriate build settings for architecture (i386, ppc, arv6), build tools, and SDK. This makes it ideal for inclusion in an iPhone project. Just git clone or download openssl-xcode from GitHub and move the openssl.xcodeproj file into the OpenSSL source directory.

We’re quite satisfied with just linking straight to the prebuilt libraries and pretending like we’re linking to system libraries on the desktop … but hey, if you want complete build control, there you go!

HTML5 Intro

So you’ve no doubt noticed references here and there to the nifty new HTML5 stuff that’s working its way out into the world, but there’s been a positive dearth of good introductions out there, as opposed to snippets trickling out here and there; well, here’s a good start on sorting that from our friends at Google:

Video Introduction to HTML5

We’ve put together an educational Introduction to HTML 5 video that goes over many of the major aspects of this new standard, including:

  • Web vector graphics with the Canvas tag and Scalable Vector Graphics (SVG)
  • The Geolocation API
  • HTML 5 Video
  • The HTML 5 Database and Application Cache
  • Web workers

In the video we also crack open the HTML 5 YouTube Video prototype to show you some of the new HTML 5 tags, such as nav, article, etc. It’s chock full of demos and sample source code.

Well worth the watch. Especially in light of the news that Google is going to drag Internet Explorer users kicking and screaming into the current millennium by, essentially, delivering WebKit as an IE plugin. They must be feeling pretty nervous down in Redmond these days!