Dale Dietrich
friedman: always supply your comparative advantage
Random header image... Refresh for more!

iPhone App Development – Where to Start

Categories: developmentiPhonemac
Tags:

iPhone App Development - Harder Than You'd Think

[October 4, 2012 Update]

On September 27, 2012, Apple accepted my first app, Fine Tip – Tip Calculator (buy it here, read about it here) into the app store. For reasons I won’t get into, I abandoned iPhone app development back in the fall of 2009. In August 2012, I took up the torch again. Within one month I was able to complete my first app.

Much has changed in three years. While most of what I wrote below still stands, ignore the book recommendations below. Instead, I strongly urge you to buy the two books below. Had they existed three years ago, I would have been able to develop my first app much quicker. I purchased them in August 2012 and had my first app done in less than a month:

[End October 4, 2012 Update]

[Original Post Last Updated: April 2009]

How hard could it be, I asked myself. I’ve developed my own applications in Basic and C. I can configure an Apache Server, install and use PHP, MySQL and other server apps. I develop and maintain websites and blogs from my home server. Over the last 15 years I’ve taught myself HTML, PHP, MySQL, CSS and the basics of Java. How hard could it be to develop a small application for the iPhone?

Let’s step back for a moment.

I have a very particular program in mind that I’ve wanted for years. It’s a very simple program – perfect for the iPhone (more on that in future posts). I could whip it up in C or PHP in about a day. I’ve never owned, or even used, an Apple computer of any kind in my some 27ish years of computing. I regard the iPhone App Store as a revolutionary new idea that pries control of mobile device apps from the big-bad telco giants and puts it in the hands of average consumers and developers — where it belongs. I see cloud computing as a very important part of our collective computing future. I want to get in on the ground floor. If my first simple program works out, I want to develop an iPhone app to work with my wishhh.com service. After that, who knows.

So, in August 2008 I registered to to join Apple’s standard developer programpurchased a Mac Mini (subsequently replaced it with an iMac) and set out to develop my first portable application for use on the iPhone.

Minimum Hardware

To develop for the iPhone you will need an Intel-based Mac running Leopard (OS X 10.5.3 or later). Any Mac released since 2006, laptop or desktop, should work.

Piece of Cake for Mac Cocoa Developers

If you have a solid grounding in Cocoa development (Apple’s Objective-C framework) with the xCode development on the Mac platform, developing iPhone Apps should be a breeze. Not so much for the rest of us.

Learning Curve for the Rest of Us

Below is a discussion of the  hurdles I have had to overcome and the online resources I’ve found useful in my bid to become the newest iPhone App developer:

  • Learning to Use the Mac and Leopard: Admittedly this will not be a hurdle for most iPhone App developers. It was for me. I have never used an Apple computer of any kind for more than a few minutes – ever! While I can appreciate the elegance and *cough* ease of use *cough* so often spoken about in the Mac/Leopard OS X world, just using the platform can be an enormously frustrating experience for a died-in-the-wool Windows user (the universal menu-bar makes me want to pull my hair out). But, I’m over that hump and moving forward.
  • Downloading and Installing the iPhone App SDK: Everything you need to build an iPhone App is contained in the huge iPhone App SDK. Like everything else on the Mac, installing it as my first Mac App was a bit of a challenge. I had never heard of .dmg files, let alone used one, to download and install Mac apps. With the help of this Mac 101: DMG files are Disk Images explanation, that challenge was soon overcome.
  • Object Oriented Programming, Objective C and Cocoa Touch: For 15 years I have been steadfastly opposed to learning object oriented programming ("OOP"). I didn’t need no C++. C was good enough for me. For small developers of small applications, I’ve never seen the benefit of inheritance, polymorphism and encapsulation – I still don’t (though I can see it being incredibly useful for developing large apps with large development teams). But for iPhone App development I didn’t have a choice. The only language available to develop iPhone apps is Objective-C, as the name implies, an object, oriented superset of the C programming language. Apple’s proprietary variant of Objective-C framework is called Cocoa. The specific part of the framework used for iPhone app development is called Cocoa Touch

iPhone App Development - Oh My Gosh

  • Crash Coarse in OOP, Objective C and Cocoa: Much of my time in the first few weeks of my quest was spent learning the basics of object oriented programming and Objective-C, and Apple’s proprietary Cocoa. While the other hurdles mentioned in this post are challenging, learning the basics of Objective-C and implementing them a real-world program with Apple’s Cocoa, was, my biggest challenge. Aaron Hillegass’ text (see below), discovered 3 months after I started all this, was instrumental in my overcoming my Objective-C hurdles. With that text under my belt, I began to make significant progress.
  • iPhone Development / Tutorial Books: In the initial days, iPhone developers were islands unto themselves. There was very little support anywhere, whether online tutorials, forums, texts etc. because Apple imposed a gag-order in the form of an NDA on all developers.  Apple lifted its NDA restrictions on October 1, 2008. As a result, there are now a plethora of iPhone application development books coming out – See here on Amazon.com for example. The first book below is not, however, iPhone specific, but was critically important for me to read before I was able to progress through the next two.
    • Cocoa Programming for the Max OS X (by Aaron Hillegass) – This book was recommended to me at the Toronto iPhone Developers conference on December 4, 2008 by an Apple employee as a good Objective-C Primer. It is terrific. It’s EXACTLY what I needed. It filled in most of the blanks I was missing.  If you understand regular C, but are new to Objective-C – START HERE! You will NOT regret making this purchase. Reading and practicing on the iMac with the example programs contained in the first 8 or so chapters gave me the Objective-C grounding I needed to move forward to the books mentioned below. As of Dec 16, 2008, I believe I have a solid enough grounding to move on to the other two books.

      Project files/code listings from this book (for basic Mac apps) can be found here (under the ‘Get the solutions’) heading. The book’s forum/errata list, such as it is, is here.

    • Beginning iPhone Development (by Dave Mark and Jeff LaMarche) -As of December 16, 2008, I just started getting into this one. It’s looking good so far. I’ll update this section as I make progress.

      Demo iPhone apps project files that correspond to the chapters of the book can be found here. The book’s user forum is here.

    • The iPhone Developers Cookbook (by Erica Sadun) – This text  was the first to arrive on November 13, 2008.  On November 16, 2008, after getting a couple chapters in, I stopped and sought out the Aaron Hillegass text above. This book is quite good but assumes a solid grounding in Cocoa/Objective-C, which I did not have at that time. I’ll come back to it at a later point. 

      All project files/code listings/objects from all projects in the book can be found here. Her EricaSadun.com website provides a forum for readers to discuss the text and ask questions.

  • Useful iPhone Dev Center Getting Started Documents: The iPhone Development Center website (free to anyone that registers – register here) contains a plethora of videos, tutorials, information, sample code, how-to’s etc. Much of it useful. Much of it not (especially for newbs like me). I strongly recommend the texts listed above. Once you have a grounding in the basics, the official Apple documents become much more useful. The most useful documents/tutorials I’ve found in the walled-garden iPhone Dev Center when I was starting out were:
    • Object-Oriented Programming with Objective-C: Thank goodness for this document. After a few days I was almost ready to give up until I found this guide. It is written for someone who understand C and needs a primer on object oriented programming. This article explained OOP to me in a way that finally made sense to me. The light-bulb went off when I read the analogy between objects to C structures. If you understand C but not object oriented programming, this document can help you over the hump.
    • Introduction to Cocoa Application Tutorial: The next most critical piece to my learning was this Cocoa tutorial. I had initially jumped straight to the various iPhone templates, sample code and tutorials but found myself a bit baffled by them. They all assume a base level understanding of Cocoa, xCode (see below) and Interface Builder (also see below) that I just didn’t have. I decided to first step back and use this tutorial to learn how to build a Mac App using the SDK tools before ploughing ahead with my first test iPhone Apps. It was worth it. In fact, I’ve gone through that tutorial twice. It nicely walks you through the MVC (model, view, controller) design paradigm assumed in all the other iPhone App documentation (see also MVC on Wikipedia), and holds your hand, step by step, through the process of designing and coding your first Cocoa application. Invaluable!
    • Learning Objective-C: A Primer: I had read this document at the very beginning of my learning process and was somewhat flummoxed by it. Coming back to it again after digesting the OOP with Objective C document and the Cocoa tutorial (each above), it made so much more sense and is a ultimately a terrific primer once you have a little learning under your belt.
  • Useful External Documents/Sites: Outside of the iPhone Dev Center, I found the following useful:
    • CocoaDev: A fantastic wiki site for MAC OS X Cocoa developers.
    • From C++ to Objective C: [pdf] While I never learned C++, as a C programmer this document at least spoke my language and helped me translate much of what I learned in the world of C to the world of Objective-C.
    • Objective-C Resource Center: This site contains links to useful Objective C FAQs, tutorials, etc. However, these are of limited use since they all pertain to generic Objective-C and not to Apple’s proprietary version of Objective-C framework, namely Cocoa.

xCode

  • xCode: To apply all the Objective C and Cocoa goodness I’ve been learning, Apple provides a fantastic development tool – xCode. xCode is a multi-facetted development tool used to develop both Mac and iPhone applications. I’ve used a dozen or so application development frameworks over the last 25 years and xCode is hands down the best. If there is anything that will delight you in the iPhone App development process its xCode. It just does what you want a development environment to do. So many of the menial tasks of the past are handled effortlessly for you. I am continually delighted as I use this tool with its deep feature set. Wonderful!  For details see the xCode Workspace Guide.

iPhone xCode Interface Builder

  • Interface Builder: Interface Builder (pictured above) is the part of xCode that you use to develop the visual/graphical interface to iPhone Apps – what you see and manipulate on the iPhone as you use iPhone Apps. It took me awhile to figure this beast out.  The video version of the ‘Cocoa is my Girlfriend’ tutorial below was helpful as was this part of the more generic Intro to Cocoa Application Tutorial. I’ve quite a bit to learn yet to feel proficient at integrating the fruits of this tool with the underlying code in my application. But this too will come. The Interface Builder user guide is here (again, available only to those who have registered).

iPhone simulator

  • iPhone Simulator: One of the last pieces of the iPhone App development puzzle (before you start testing on an actual device that is) is the iPhone Simulator (pictured above). At any time during the development process you can build and test a version of your iPhone App and run it in the iPhone Simulator. It’s pretty nifty and easy to use.
  • Online Tutorials: There are several online tutorials that hold your hand, step by step, through basic iPhone application development:
    • Your First iPhone Application (Apple’s introductory tutorial). This includes a terrific step-by-step description of the basic bootstrap process. I wish I had read this one a lot earlier than I did. It answered a lot of my initial “what the?” questions. Note: You will need to be logged into the iPhone Development Center to access this.
    • icodeblog Tutorials: A computer science student named Brandon at the University of New Mexico has been posting useful iPhone App development tutorials on his icodeblog blog. His forum allows would-be iPhone developers to discuss his tutorials and learn from each other. His tutorials have been invaluable to my learning process.
    • Cocoa Touch Tutorial: iPhone Application Example – [video version] (Cocoa is my Girlfriend);
  • Other Online Resources:
  • SQLite Manager Firefox Add-on: Not all iPhone Apps require/use databases. My first simple application does. The iPhone SDK contains, and the iPhone uses, SQLite to handle your iPhone App database needs. If you use Firefox, I  recommend this SQLite Manager add-on to create, modify, populate and manage the database tables your iPhone application will need. It is much easier than working with databases via the Mac command line interface. Save the resultant tables in your xCode project directory and, voila, they are available to your iPhone App.
  • Testing Apps on iPod Touches or iPhones: I have yet to completely unravel all the mysteries of testing  iPhone Apps on my personal iPhone, becoming a certified iPhone Developer, let alone submitting an app for approval and inclusion on the App Store. At a minimum you’ll need to join the “iPhone Developer Program” ($99 for most of us). Paying your $99 does not mean you’ll be automatically approved to distribute your app through the App Store. Frankly, I’m not ready yet anyway. But it will let you test your apps on your iPod Touch/iPhone and allow you to distribute it to up to 100 friends to test as well. The process is described in detail in the Erica Sudan text (see above) and also in this online description:

    When my simulator testing is done I’ll venture down that path and update this post accordingly.

I’ll continue to update this post (or write new ones) from time to time if/when I find more useful iPhone App development resources, blogs, forums and as I learn more about the developer certification and App Store submission process.

I’d appreciate any useful resource suggestions that other iPhone App developers can make in the comments below. In particular, if there are other blogs/tutorials out there like the icodeblog, I’d really like to hear about them.

Digg! Digg Del.icio.us