I bought iPhone Programming in May 2010 after starting a few other books and never getting past the first few chapters. There was something different about this book that seemed to resonate with me and so I kept at it. I went through every chapter, typed in every line of code, read all the “for the more curious” sections and attempted every challenge - hardest one being make your photo look pretty in Chapter 16 !
About half-way through the book I started to think “Wow - I seem to be understanding all this stuff - maybe I could release an app” and so I started thinking about what it might do.
In the end I decided to focus on a problem that I faced when trying to cook a Sunday Roast. Each dish (Meat, Potatoes and Vegetables) is fairly simple on its own but working out when to start each one and when to do all the intermediate steps so that they all end at the same time can be quite hard. My old technique was to write out each step from the recipe books and then work out a back-planning gantt chart. I’d then set the oven timer for each event to prompt me on what I needed to do next. There were already lots of really good recipe apps but I couldn’t find one where you could enter your own recipes and set the alarms accordingly.
I started thinking about the design and at the time Cocoa only had Push notifications. I didn’t fancy the idea of maintaining my own website and although I thought I could make it work with NSTimer I wasn’t really comfortable that it was going to operate as I’d hoped. Then, with the introduction of iOS4, came Local Notifications and I now had everything I needed.
A large part of the app was the data entry and so that’s where I started. You need to select the dishes from the main screen, have an edit mode so that you can add a new dish, within the dish add each step and then edit the details. Most of what I needed was in Chapters 10 through 16 (UITableView and UINavigationController) with a bit of help from Chapters 18 and 19 to animate some of the transitions.
Next up was the ability to choose an alarm sound and also record your own alarms and most of this was explained in Chapter 20 for the audio and Chapter 25 for the settings with some OpenGL for the level indicator taken from an Apple example app.
I then got the UILocalNotifications firing and was starting to get a sense of how the app was going to work. It was at this point that I made the most expensive decision I would make (in time and effort) regarding functionality. I realised that some dishes would need variable timings depending on weight (i.e. 30 mins per Kg) and also that some steps, within a single dish, need to run in parallel (i.e. Preheat Oven while mixing ingredients). I decided that a single text-based data entry screen was going to be very hard to visualise and so a better option was an interactive gantt chart. I built a UITableView with a subclassed UITableViewCell and used a UIProgressBar to depict the step duration and sequence. Fairly straightforward, but next up was how to show the links between steps. I needed curvy dependency lines (UIBezierCurve) from one UIProgressBar within a UITableViewCell to another. In the end I went with a completely separate UIView, just for the lines, overlaid on top of the UITableView and used the convertRect method to translate the coordinates between the two views. After a bit of trial and error this came into place, including the UIPinchGestureRecognizer to handle resizing the row height) but it didn’t work when you had a line from a step visible on screen to a step that was off screen. Due to the reuse of UITableView cells I didn’t know what the coordinates were when the cell didn’t exist yet. I ended up having to code specifically for this scenario using the visibleCells array to determine when something was on screen or not.
Next major hurdle was the scheduling algorithm. With variable timings, Finish to Start relationships and, in a moment of wilful abandon, I also decided to allow Finish to Finish relationships, the next four weeks of all my spare time was lost trying to get this right. I’m sure there is an excellent paper on Graph theory and dependency node analysis out there somewhere but I couldn’t find it. Ye gods was this hard. I must of reworked this piece of code at least 10 times, sometimes thinking I’d got it and then finding a scenario that destroyed the whole concept. Sometimes just about getting there and then looking back at the code, littered with horrible complicated nested if statements, and thinking I’ll never understand this again. The only amusement I had was that I’d called a dependent a child and the owner a parent so I had lines of code that said if [step child] and if [step parent] - not very funny but these were desperate times……
Finally I got there with a rather elegant, if I say so myself, recursive solution. It looks for all the non dependent steps and then uses those to recursively shuffle everything along, honouring the Finish to Finish and Finish to Start dependencies until it runs out of adjustments. I was a bit worried about performance as I use the algorithm to not only schedule the timings but also to validate the action a user takes when creating dependencies i.e. You can’t make this step dependent on another step that is already dependent on you via it’s parent - but in practice it’s worked out very fast with no issues whatsoever. (famous last words).
So now the app was really starting to take shape. I used it to create my Sunday Roasts, got some friends to test it out and it really does make the planning of a multi-dish meal a breeze.
Based on feedback I added some additional functionality - the ability to start or end a meal at a set time and an overview screen so that you can see all the notes and timings for a particular dish in one view. I looked at using NSAttributedString for this but in the end went with a UIWebView and did all the formatting using CSS. I also added the ability to email dishes to friends after reading an article by Ray Wenderlich.
Worst bit of feedback I got though was the app looked rubbish ! (not the UIWebView the rest of the app). I’d based it on the standard look of most of the utility apps, blue headings, white background etc. This was the second hardest part - choosing colours, trying to work out how to get gradients on the cells without making the scrolling sluggish, tinting the Oven door to make it look like a real one, choosing fonts and sizes, lots of trial and error and lots of studying other apps to try and work out why they looked so good. In the end I got to the point where I thought it looked much, much better but still didn’t have a wow factor, however this was all taking way too long so I decided to go with what I had as I’d reached the point where each tweak wasn’t really improving things much.
Beyond the app
Next up was the icon - I’d dabbled with Photoshop to touch up photo’s but never delved into layers or the drawing features. Another massive leaning curve for me - went through loads of tutorials, magazines, books just to get a half reasonable icon. Biggest lesson here was that I initially started with a 57 * 57 pixel canvass but you will also need a 114 * 114 for the retina display and a 512 * 512 for the iTunes artwork. So start with a much bigger canvass and then scale down for all the icon variations.
Final peripheral activities were to get some tutorials and a promo video together. I used Screenium to record the app screens and iMovie to edit the video’s. The promo video came together really quickly. I used a JVC camcorder to film myself going through a bunch of recipe books at the kitchen table and manually drawing out a gantt chart and then cut to setting my oven timer 3 or 4 times to show how laborious this is. Speeded it up 20x and applied a grainy old movie effect. Then I recorded the screenshots to show how much easier it is with the app. Edited some titles and dug out some old music snippets I’d recorded years ago. Whole thing came together start to finish in under 2 hours. The tutorials were a bit harder - navigating an app, typing in recipes and speaking at the same time were beyond my multi-tasking capabilities. So I broke it down into separate steps - Record the screen shots while talking but don’t worry about what you’re saying, listen back to what you recorded and write it all down, edit the text to what you really wanted to say, edit the video to remove any mistakes and then play back the video and re-record the narration while reading from your edited text. It still took a few takes and I had to edit out a few um’s and ah’s but much easier than trying to do it one go.
I found the provisioning process very confusing at first but once you’ve got the right provisioning profiles, imported them into your keychain and set up your build settings to include the right codesigning settings it all works ok. The iOS Developer Program user guide is well worth studying in depth to understand how all the various elements work together.
So at this stage everything was ready for the big event. Started going through the app store submission process and realised I needed to put a bit more thought into the app description, screenshots and keywords. Put something together and started again. It then became apparent that the app name I’d been planning had already been taken - even though I couldn’t find an app on the store with that name. No big deal - think of a new name - but it meant I had to redo all my tutorials, user guide, icons and some app screen headings. Went through it all again and it then became apparent that if it’s a paid app then you must have a website. I didn’t - so off to blogger to create a website - another learning curve for me.
And finally it was submitted - app goes into waiting for review and I start searching for an indication of how long this will take (about a week). In the meantime I keep testing the app as this is the point of no return right, and then, horror of horrors I discover a bug. I include a few default alarm sounds in the app bundle and at the last minute I’d changed one of the names but forgotten to rename the associated .caf file. Oh my god what am I going to do ? - phew, there is an option to reject you’re own binary. So rename the offending file and think to myself, have I really done enough testing - especially given the last minute name changes and boy was that a horrible feeling. So another week of rigorously testing every permutation I can think of and re-submit. Sure enough 5 days later app goes into “In Review” and the next day - “Ready for Sale”. Now as luck would have it I’d put the release date as a month into the future as the day it was approved I got food poisoning and was stuck in bed with a temperature of 104. I’d been so excited - checking emails every hour and yet when it finally happened I didn’t really care. Anyway, I recovered after a few days and set the date for release to the following day.
So - it’s been live for one week. Sales have been extremely disappointing, to find the app you have to virtually type in the exact name, Apple hasn’t featured it as app of the week and my YouTube video’s are registering as less than 20 views - and I think most of them are me. So I guess I’d better start reading up on app marketing !
However, becoming a millionaire and retiring was never really the point when I started this journey so I’d still do it all again. There is a tremendous amount of satisfaction (and a fair degree of pain) to be had from having an idea, learning how to implement it and then actually making it happen. As the Big Nerd site says For the beginning iPhone developer, “I understand how to do that” is a nice statement…“I’'ve done that is much better.” and I can certainly vouch for that.
So thank you Joe and Aaron for providing the inspiration and guidance that got me to this point - it would never have happened otherwise. And to those of you still reading, keep at it - it’s worth it - and I wish you every success.