Yet another iPhone programming “101” article
Okay, okay, so why yet another column on beginning iPhone programming when the net is gravid with similar articles?
Well, when I was asked to start a semi-irregular column by the kind folks at www.iPhonenes.com the general topic would be from an app author’s point of view. So I really need to start at the very beginning (from which I understand is a very good place to start).
It was just about two years ago when the first version of the SDK (Software Developer’s Kit) was unleashed upon the huddled masses yearning to breathe free. While iPhone homebrew was out and about through the dedicated efforts of folks like the iPhone Dev Team, setting up the initial development environment was not for the faint of heart and would bring a frown upon the brow of the mothership once the official app store was open for business. So if you care about being able to proudly point out your app in iTunes to your friends, you gotta play by the rules. And that means Apple’s SDK and Apple’s restrictions.
There are good reasons for this: Apple wanted to assure to their customers that the apps have been proven to be safe from malicious code and were future-proofed by using the approved library calls. The latter would be essential, especially in the early days of the iPhone’s operating system, as it would likely be updated frequently. Apple would need the flexibility to tinker with the underlying “private” calls without having to worry about breaking existing applications. And as various systems mature we can (hopefully) expect more of the secret sauce to be approved for outside development.
So with this in mind what does it take to write a cool app and make a million bucks? (Uh, start with a cool app idea and two million bucks?)
The early days of the App Store was a smaller and far swifter version of the great “internet land rush” of the late 90s. And in many cases it still is, as the market still is growing and mutating at an amazing rate. But as such, the rules change almost on a daily basis. Your favorite iPhone blog last week might be gone this week. Marketing ideas that were gold last summer are now frowned upon. The uber-cool app from Christmas may already look dated by March thanks to dozens of imitators.
So if you feel compelled to write an application, the first rule is to ensure that you can do it for the pure fun of it. Don’t expect or plan on it making you rich, the many newspaper articles not withstanding. (Most actors in Hollywood are working stiffs like you and me, and aren’t jetting around in one of their private jets just to get dinner at their favorite taco place in Mauritius.)
Now, you may be pleasantly surprised, but if the $1000/day idea turns into the $6.95 idea, buggers on you. Remember, there are by best estimate over 150,000 applications out there all vying for attention making it a lot harder to get noticed now than even a few months ago. If you do it for the fun of it, 7 bucks a day adds up to some nice extra money for more toys with flashing light thingies over the course of a year. If you hated working on the thing, you’ve wasted potentially hundreds of hours and risk turning into a bitter old coot chasing kids down the street with your cane shouting “Hey kids! Git off my lawn!!”
If the above paragraph didn’t discourage you, good! Now you are ready to start buying and doing cool stuff. Obviously you need a Mac of some sort. I use a Mac Mini at my “real job,” and a white MacBook at home (with 4G Ram/500 G drive). Chances are you might already have these if you are a true Apple fanboi or fangrrl.
Next you need to get a developer’s account. These are free if you just want to play around to get to know the system and the dev environment. But you will be limited to only running code on the iPhone simulator. What? You really want to run it on your own iPhone and sell the thing? Then you need to scrape up $99. With that you can almost call yourself an “iPhone developer.”
I said ALMOST!
Next you need to know something about programming and in particular programming under the wacky OS-X environment usually named after large felines. Once you get the hang of it, OS-X programming can be pretty straightforward. If you know nothing about software development, then be prepared for a learning curve steeper than the walls of the halfpipe in the Olympics. Not afraid of learning? Good! Then pick up one or more of the Apple OS-X/iPhone books by Aaron Hillegrass, be willing tune out of the Firefly marathon on cable, and mainline his coding goodness over course of a long weekend. He writes in a very clear voice that can be of help even to novice programmers. If you’ve done all of this, and still don’t get the programmer’s joke embedded in the street address of Apple’s main campus, then have you considered tap dancing? (I know a great teacher…)
Once you have the dev system installed you will have three main things to examine. The first is called Xcode. This is where the magic begins. This is the full developer’s environment that includes project wizards, editors, compilers (wazzat?) and a simulator that will let you run code on your Mac even if you don’t have an iPhone.
The second piece is Interface Builder or “IB” for short. While the SDK lets you create interfaces by hand, generating all of the code needed to create even simple lists, login dialogs and so on, gets to be really boring after a while. With a little bit of mouse action you can create the various UI elements for your app. However, in order to actually tie your program together with the interface files called “NIBs,” you will need to do some real coding.
The third part of the equation is Instruments, a beefy debugging tool. You can ignore this for now, until you are well along in your app as it is both baffling and very powerful at the same time.
That’s it for part one. Next we’ll learn to say “hello world!” in OS-X-speak.
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000