Happy Birthday
They say the best gifts are handmade. For my wife’s birthday last year, I came up with the idea to write a simple little “birthday card” application and slip it on her iPhone to surprise her. I scanned in some graphics from a real birthday card and digitally chopped it up and added some animation to give it that true “Made in Flash” feel, and stayed up until 1 AM working to get ad hoc provisioning working on her phone. I even had it register a protocol handler so I could send her an email while she was at work saying “click this link: <happy://birthday> from your iPhone email” and it would launch the application. It was a hit.
The one thing I had planned but couldn’t get working was for the appliction to play a song. Core Animation took enough of my brainpower at the time, and the idea of learning AudioUnit in such a short time was quickly dismissed–I would have to “ship” without that feature. But a recent post by Mobile Orchard’s Dan Grigsby showing the simplicity of AVAudioPlayer prompted me to pull the code off the shelf and give it an update.
What a dusty shelf that was. The project was configured for SDK 2.1(!) and some of the code was indicative of “tweaking until it works.” As I was updating the project for 3.0, moving code to Interface Builder and swapping lots of Core Animation code for UIView animations, it dawned on me that this has surprisingly many little tidbits of code and would be good to share.
