Jul 30

There is a lot of hoopla over Google’s last app (Google Voice) not being approved for release on the App Store. Apple has been in the news multiple times about the App Store and most of it negative. There is no doubt that something smells at Apple when it comes to the process of application approval. They have got to clean this up or they will find themselves losing their market dominance. Now, I don’t have any inside scoop on what is going on with the Google Voice debacle, so I can’t comment to much on it. But with all the negativity and apparent anti-developer behavior on the part of Apple why do people continue to develop for the platform?

I can only speak for myself, but there continue to be enough intriguing benefits to writing for the iPhone.

  1. One Man Shops Possible - It’s been awhile since a single developer could do something that made a real splash. The ability to spend some time at your home, develop an application and have a chance (no matter how small) of selling it and making real money is incredibly enticing. The Garage development mentality is why many of us got into programming. In my case, I started programming at a young age writing games for my friends on an old Commodore 64. That feeling is what keeps me going; doing my own thing and getting it in front of other people. Being able to develop a product that can be put on a store to be placed in front of the eyes of thousands, maybe even millions, and Apple takes care of all distribution concerns is empowering.
  2. Deliver to a Known Platform – One of the biggest pains when developing software is optimizing for the lowest common denominator with unknown hardware. You don’t know what graphics capability the system has, does it have a web cam, what is the primary input? With the iPhone, you know exactly what you have at your disposal iPod Touch through three generations of iPhone. You’ll have a camera, touch screen, location device (of varying accuracy). You can write your program for a single platform and you’ll know how it will look for every customer you have. Your only worry is making sure it runs fast enough on the slowest (1st Gen iPhone) machine.
  3. iPhone is the Current Top Dog - Fact of the matter is the iPhone continues to dominate the smart phone market. It’s the hippest, coolest thing around and getting visibility here is highly desirable. It’s a beautiful piece of electronics, with a clean UI and a reputation for having only the best applications (never mind the fact that of the 60,000 applications on the store the vast majority are utter trash). When you think of the iPhone you think of elegance. That’s a club I want to be part of.
  4. New Skills – Objective-C is a new language for me. And the language of choice for my platform of choice. I’m a recent (2 years) convert to the Mac platform, and enjoy it enough that I would love to continue working on it. As such, it is always good to develop skills that can be utilized here, knowing Objective-C, Cocoa, UIKit and Cocoa Touch provides skills needed for Mac Development. Even if I don’t produce award winning iPhone applications, I’m still building up the skills to continue trying and possibly get paid to do so.
  5. Enjoyment of the Language and Tools - And while attempting to learn new skills to stay on my platform of choice I’ve really come to appreciate the language and the development tools provided. I’ve come to feel that Objective-C is an elegant well design language, Cocoa and the Foundation classes are beautifully thought out with clean interfaces and detailed documentation. Xcode, Interface Builder, Instruments and Shark have provided me with tools to quickly get applications up and running. I’ve never been able to build a working application (admittedly simple) with a clean, good looking UI as fast as I have with Xcode and Interface Builder. The tools were developed in 1988 for NeXT and continually improved and iterated on. 20 years later, they have turned into a clean efficient suite of development tools.

Apple has had a phenomenal first year of sales on the App Store. But, they have had a lot of negative publicity due to some of their poor choices. I hope the spend the upcoming years improving this process and getting things in line, as I continue to be part of it for awhile.

Tagged with:
Jul 28

Joe Hewitt, creator of the Facebook iPhone App, has open sourced and released many of his UI additions from that App as part of the Three20 package. They fall under the Apache 2.0 license. There is a lot of great stuff here.

Tagged with:
Jul 11

When refactoring existing code, be careful to ensure that your Interface Builder outlets are still correct. For example, if I have a simple controller class with the following attributes:

XcodeScreenSnapz004

They are defined as IBOutlet’s and are, therefore, connected in Interface Builder to UI elements.

Interface BuilderScreenSnapz001

Now, let’s say we wish to change the name of “switcher” to “switchElement”. Obviously, the worst thing we could do is make the change manually, even without the Interface Builder connections we’d have to manually update both the .H and the .M files. So, we should make use of Xcode’s refactoring mechanism.

Right click on the attribute in question (“switcher”), and select Refactor

XcodeScreenSnapz005

This will bring up a new Dialog with the “rename” option already selected. Type in the new name, it will identify what files will be changed. You’ll notice that the .H, .M and the nib file are selected for changing.

Once you apply the change, you’ll need to revert the nib in Interface Builder to the version on file. However, Xcode doesn’t handle everything for you, there is one more step that you have to take care of. If you open up the connections part of the UI, you’ll see that it did, in fact, update your connection. But, the old outlet name still appears as another entry and the new name has a warning. The warning is that the class doesn’t have an outlet with the new name.

After banging my head for awhile trying to figure out why they wouldn’t take the final step during a refactor I realized I needed to do one more thing. Save the .M and .H files. Now, everything is in sync and working properly.

Tagged with:
Jul 07

A friend pointed me to the Stanford iPhone Classes offered on iTunes as part of iTunes U. There are a number of free videos (23 to be exact) taught by Apple Engineers (Evan Doll, Alan Cannistraro and others). I’ve gone through the first two lectures. Admittedly, they require substantial fast forwarding in sections due to length discussion about office hours and the like, the core material is outstanding.

Find it here: http://deimos3.apple.com/WebObjects/Core.woa/Browse/itunes.stanford.edu.2024353965

Tagged with:
Jul 05

Amazingly, Xcode comes built with a Unit Test suite and an Application Test suite. However, it took a bit of trying to fully understand how to set it up. The key element is adding a new Build Target.

XcodeScreenSnapz001

Set the new target as “Unit Test Bundle” and you’re done. Now, you can add new class files using the “Objective-C test case class” as the template and write Unit Tests. Now, make sure you set the only build target of this new class as the Unit Test target you created previously (that’s very important).

Now, when you want to run your unit tests, simple switch your build target and hit the build button.

XcodeScreenSnapz002

Tagged with:
Jul 05

I have to admit, I haven’t been doing a whole lot of Obj-C. But, I’m having a hard time grasping the basic ‘[' syntax. The following line:

[hello drawAtPoint:location withFont:font];

is equivalent to:

hello.drawAtPoint(location, font);

in a language like C++ or Java. However, one of the major differences (besides the obvious usage of brackets) is that the parameter names are included in the call: “withFont”. This is not true with the first parameter (“location”). Therefore, it seems that the name of the function should indicate the proper first parameter. This is the case with “drawAtPoint”, where “point” is the “location”.

What is really aggravating and increases the ramp up time for learning is the way the mix syntax usage. Some libraries are C libraries and are called using standard C syntax.

CGPoint location = CGPointMake(10, 20);

is right next to a

MyView *myView = [[MyView alloc] initWithFrame:[window frame]];

This is a huge source of confusion on my part. How, as a user, am I supposed to know what language everything I might want to use is written in? As I learn, I’ll write.

Tagged with:
Jul 04

There are a few steps that one must go through in order to setup their machine for iPhone development. First, you need to install XCode (and related tools), next sign-up for an Apple Developer Connection account, and last download and install the iPhone SDK.

Installing XCode

This is fairly straight forward. If you’ve recently purchased a new Mac, you’ll have a DVD with called the Tools Disk. Simply put this in the drive and run the installer. This will install XCode and many other developer tools. I’ll go over the tools in later posts as I learn about them. But some highlights are:

  • XCode – the primary IDE for Mac development. This is where we’ll be spending much of our time editing source code.
  • Instruments – a tool for gathering profiling information about your running application.
  • Interface Builder – this little guy is the graphical UI tool for setting up your interface and connecting it to source code.

If you don’t have the proper DVD, you can download the Tools DMG from the Apple Developer Connection Site.

One interesting note, is all Applications for development go into /Developer/Applications, not /Applications/Developer as I would have expected. I must admit this caused me a bit of confusion for awhile.

More information can be found at: http://developer.apple.com/documentation/Xcode/Conceptual/XcodeCoexistence/Contents/Resources/en.lproj/Basics/Basics.html

Sign Up for Apple Developer Connection

You can sign up for a free ADC account. This will give you access to a number of SDKs, including the iPhone SDK. It also gives access to a substantial amount of documentation (including the beginning iPhone development doc referenced below). Go to developer.apple.com and sign up. Later, we’ll need to sign up for the iPhone Developer Program (which is not free) in order to actually get our application to the iPhone device (rather than just the simulator), but that’s for later when we have something worth showing off.

Download and Install the iPhone SDK

Once you have your ADC account, sign in and go to http://developer.apple.com/iphone/program/sdk/. Here you can get the SDK (over 2 GB of SDK goodness). Once the download is complete, install it, and we are ready to begin.

Additional Info

I’ve decided to go through iPhone Development Guide for my first “Hello World” app. You can find it here: http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/000-Introduction/introduction.html

Tagged with:
Jul 03

One of the key elements for iPhone development is a machine running OS X. There are currently no development tools to allow iPhone development on any other operating system. I’ve been a fan of Apple’s computers for a couple years now and already had a MacBook Pro. Fortunately, this allowed me to get started relatively quickly and easily.

Where to buy? I recommend moving next to an Apple employee and getting a 25% discount. That’s what I did and it worked out well. However, that’s not terribly practical for most people. I have bought refurbished Macs before and have been very happy. You can easily save a couple hundred dollars.

FirefoxScreenSnapz005

The above is from the Refurbished Store as of the writing, and shows that they have the “latest and greatest” available. Apple provides fantastic support for refurbished machines, treating them as new. I highly recommend going this route.

Once, I had my machine, I found out that OS X loves memory. Its memory model will allow it to take advantage of all the memory you can physically put into the machine. I upgraded my Mac’s RAM to 4GB (purchased from newegg.com as Apple’s memory prices are absurd). After putting the new modules in, I noticed a marked speed improvement. Applications are much faster to load, switching between is very fast. My machine is now a year old, and I still feel like it’s a better machine than most brand new computers I come across.

FirefoxScreenSnapz004

Many people have reported being very happy buying a basic Mac Mini for iPhone development. This is certainly a cost effective way doing so, especially if you don’t plan on using a Mac for your basic computing needs.

Once you have the machine you want, update to the latest OS X version and install the Apple Developer Tools.

Tagged with:
Jul 02

Garage development is back. The days of two guys staying up late, hacking away at code with dreams of fortune and fame are back. No longer do you require a $50 million budget to make a AAA title that will scarcely make enough money to pay back the development costs. Enter the iPhone, our savior of development. Now, anybody can throw their hat in the ring and barely make enough money to pay back development costs. But, this time development costs are very low!

This blog will chronicle my journey down the development of simple iPhone applications. As I learn, I will log it here. Including setting up and educating myself on the tools, Obj-C, Cocoa Touch and anything else I find along the way.

Tagged with:
preload preload preload