First iPhone App In One Day

January 4th, 2009

I was actually surprised by how easy it was to create my first iPhone app – From launching Xcode for the first time, building an application on the simulator, to paying $99 so i can legally put apps on my iPhone, and getting my app to run on my iPhone – all in one day.

The following is a summary of how to create your first app using iPhone OS 2.2 and the iPhone SDK available in December, 2008.  I write this blog since documentation can become out of date very fast (ahem, apple).

First, this is what you will need

  • Intel Mac with OS X 10.5.5 or later (I used 10.5.6)
  • iPhone SDK for iPhone OS 2.2 (I had build 9M2621)
  • iPhone with OS 2.2
  • $99 if you want to run your app on your iPhone – its free to develop and run on the iPhone simulator that comes with XCode

How to create a simple “Hello World” app on your iPhone

  1. Login to iPhone Dev Center
  2. Download and install iPhone SDK if you have not – its 1.56 GB (HUGE, may take more than a day to download).  It comes with XCode 3.1.2 and everything you need for iphone development.
  3. Follow this 6 minute Hello World video.  Note: after a minute he launches Interface Builder – one of the windows does not launch by default, launch it from – Tools – Identity Inspector
  4. Done with free section – Hello World on Simulator
  5. Pay $99 to join the iPhone Developer Program – lets you install apps on 100 devices (iPhone, iPod Touch)
  6. Once you’ve paid, download the “Program portal user guide” (right side, near top) from the iPhone Developer Program Portal, (links will not work unless you login and are in the program).
  7. Follow the instructions in the user guide (version 2.4 is what I had).  It is mostly accurate (getting certificates, etc) up to section called “Installing iPhone OS” (pg 18) where it says

    To run your code on an Apple device, you will need to install iPhone OS onto each development device and “restore” each device to a development state. Note: Once a pre-release version of iPhone OS is installed on the device you cannot restore the device to an earlier version of iPhone OS. The device may only be used for development and testing purposes until that version of iPhone OS is publicly released. Please DO NOT install the iPhone OS before registering device UDIDs, as installation on non-registered devices will render them inoperable. The public release version of iPhone OS should be installed using iTunes.

    ….

    1) Download the iPhone OS Disk Image (.dmg) from the iPhone Dev Center for the Apple device you are using.
    2) Connect your device to your Mac, close iTunes and launch Xcode.
    3) Once the device is detected by Xcode, select ‘Use for Development’ when prompted.

    • Ignore.  You do not need to download or install anything special for development if you have the regular retail version 2.2 on your iPhone (normally installed using iTunes).  I assume these instructions were for 2.1 or 2.0 or earlier.
    • Just backup iPhone on iTunes, close iTunes, launch XCode, go to Window – Organizer,
      click on your iPhone, click “use for development” under summary tab. That’s it.
  8. Continue with guide, create App ID (when choosing your “Bundle Identifier”, I recommend using asterisk like: com.mysite.*), install profile, etc.
  9. If you follow the guide exactly, you will see this error when you try to install app on your device (aka iPhone)

    Your mobile device has encountered an unexpected error (0xE800003A)
    ApplicationVerificationFailed

  10. Here’s how you fix the above
    • You must create entitlements.plist – On you XCode Project, goto File->New File…->iPhone OS -> Code Signing ->Entitlements.  Just name new file “entitlements.plist” (it should be created in your project directory).
    • Goto Build Info (on your main project window in XCode, right under “Groups & Files” click on project name at top, then click the big Info Icon at the top middle). Under “Build” section, look for “Code Signing Entitlements” – the Value is probably blank – double click, in the popup window type in the new file name “entitlements.plist”
    • Under Target Info (on your main project window in XCode, under “Groups & Files” Targets list click on project target name, then click the big Info Icon at the top middle). Under “Properties” section, change “Identifier:” from com.yourcompany.xxx to the “Bundle Identifier” you created  on the program portal website under App IDs – do not include the ten character “Bundle Seed ID” prefix, just the “Bundle Identifier” you picked. ex: com.chadnorwood.${PRODUCT_NAME:identifier}
  11. DONE.  You should now be able to create new projects and more apps.

Links


Warning: count(): Parameter must be an array or an object that implements Countable in /nfs/c04/h03/mnt/66006/domains/chadnorwood.com/html/wp-includes/class-wp-comment-query.php on line 405
  1. No comments yet.
  1. No trackbacks yet.