iPhone 101
At the start of this page (August 8, 2009), I am brand new to iPhone development. That includes Objective C, Xcode, the iPhone Developer Portal, etc. As I work through the process of building my first iPhone apps, this page will document important lessons learned. Fortunately I have some experience with how Mac applications are packaged, having created the Mac version of DD Poker. Even though that was written in Java, the concept of application bundles, Info.plist, icons and the like are very similar.
Books
I've ordered several books on the topic from Amazon and bought one from my local Barnes and Noble. Currently working my way through O'Reilly's iPhone SDK Application Development.
Developer Certificate
Using the Certificates tab of the iPhone Developer portal:
- Downloaded the WWDR Intermediate Certificate and double clicked on it to install it.
- Requested a new certificate
.
Note: My first attempt failed (when uploaded, it was marked as an invalid certificate). You have to make sure no rows are selected in the Keychain Access (as noted in this how to
). Yet, I still couldn't get it to work - my certificate requests were marked as invalid. I noticed I wasn't getting the checkbox Let me specify key pair information in addition, it didn't seem to be adding create a new public/private key pair with my name.
I decided to create a new key chain called iPhone in the Keychain Access utility. I selected that and then, when doing Keychain Access => Certificate Assistant => Request a Certificate from a Certificate Authority, I finally got the 'let-me-specify' checkbox. In addition, after following the steps, a new 'Doug Donohoe' public/private key entries were created (but oddly under the login key chain). I may have missed a step in the sequence here, but uploading to the iPhone portal on the Certificates tab finally worked.
It isn't entirely clear why creating a new key chain did the trick. My guess is that it was using the existing public/private key pair that is in the login key chain and perhaps that is not compatible.
Registering my iPhone - iPhone 3.0.1 and Xcode
Started Xcode and Opened Window => Organizer.
To get Xcode to recognize the iPhone 3.0.1 update, need to create a symlink:
cd /Developer/Platforms/iPhoneOS.platform/DeviceSupport ln -s 3.0\ \(7A341\)/ 3.0.1
I noticed Organizer has a capability to take a screen shot of what is currently on the iPhone plugged into the computer.
Anyhow, from the Organizer Summary tab, grabbed the Identifer value and used that in the Portal Devices tab to register my iPhone.
App Id
Initially, using the App IDs tab, created an id for com.donohedigital.*, a wildcarded id hopefully good for development until I have a specific app.
Provisioning
Initially, using the Provisioning tab, created first Development profile, Donohoe Digital 1 using the com.donohoedigital.* App Id and enabling my registered iPhone. It only took a few minutes to become active, where upon I downloaded the Donohoe_Digital_1.mobileprovision file.
Important: There are two steps to import it:
First, back in the Xcode Organizer, I selected my iPhone under DEVICES, and on the Summary Tab, I clicked the + button to add the Donohoe_Digital_1.mobileprovision to my iPhone.
Second, I had to create this directory and copy Donohoe_Digital_1.mobileprovision here:
~/Library/MobileDevice/Provisioning Profiles
Once you do this, the profile should show up when you select the Provisioning Profiles tab under IPHONE DEVELOPMENT. This step is necessary to be able to configure code signing for the Target application (so the provisioning profile is selectable: Command-I, Build tab, Code Signing section, Code Signing Identity row.
Why this is two steps is beyond me...
Learning Objective-C
Objective C, like C and C++, unfortunately still uses header files. Whereas in Java, the class file defines the defines the public interface and the implementation, in the C world, the header file defines the interface.
Besides the online-docs, header files are a good way to learn what is in the available APIs (or Frameworks in Objective-C parlance). For the iPhone SDK, check out this directory:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks
And check out all the frameworks:
AVFoundation.framework AddressBook.framework AddressBookUI.framework AudioToolbox.framework AudioUnit.framework CFNetwork.framework CoreAudio.framework CoreData.framework CoreFoundation.framework CoreGraphics.framework CoreLocation.framework ExternalAccessory.framework Foundation.framework GameKit.framework IOKit.framework MapKit.framework MediaPlayer.framework MessageUI.framework MobileCoreServices.framework OpenAL.framework OpenGLES.framework QuartzCore.framework Security.framework StoreKit.framework SystemConfiguration.framework UIKit.framework
Upgrade to Snow Leopard
On 9/5/2009, I upgraded to Snow Leopard, which comes with a new Xcode. This is the sequence that works:
- Upgrade to Snow Leopard
- Install new Xcode (from Snow Leopard installation DVD)
- Download and install the iPhone Snow Leopard SDK