Make your own native iPhone apps on Leopard using XCode
I was bored last night and thought I would get my development environment setup for making native iPhone applications. Steve Jobs is going to announce an official SDK at Macworld on the 15th, but who knows when it will be available and to whom it will be available. I know one thing, I am sure Apple's SDK will be much easier then what you and I have to go through to make native applications for the iPhone. I will go through everything, step by step, and when we are all done, you will be making native iPhone applications using XCode 3.0 on Leopard. There are other guides and easy setup for Tiger. I know there are some guides floating around for Leopard too, but they are missing things or not completely clear. I am going to try to make this as easy as I can and step you through the entire process. Go grab your favorite energy drink, some junk food, and your Lemur to keep you company.
Before you get started, make sure you have XCode 3.0, X11, X11 SDK, and Mac OS X 10.4.x SDK installed. Here we go...
Step 1. Set up a staging area to do all your work. On my machine this is ~/Code/iPhone/.
Step 2. Get the disk image of your iPhone file system.
Start Activity Monitor and kill the iTunes Helper process.
Download iNdependence.
Download the iPhone 1.1.1 firmware. When it downloaded for me, Leopard automatically unzips the file. You will need to select the 5 files in the folder it extracts and compress them again. Name the zip file iPhone1,1_1.1.1_3A109a_Restore.ipsw.
Connect your iPhone to iTunes. Press and hold the Home button and the Sleep/Lock button at the same time. The phone will eventually show the Slide to Power Off slider. Keep holding the buttons down until the phone shuts off, at this point count 3 seconds in the 1 1000, 2 1000, etc fashion. Once you hit 3 seconds, release the Sleep/Lock button and keep holding the Home button. iTunes will eventually pop a dialog that states it has detected an iPhone in recovery mode. You can dismiss this dialog. You now want to Option+Click the Restore button. You can not navigate to the iPhone1,1_1.1.1_3A109a_Restore.ipsw file and start the restore. Kick back and wait about 5 minutes. Pet your Lemur and give him a sip of your energy drink. The restore process will error out toward the end. Dismiss the error dialog and exit iTunes.
Okay. Now you have a screen on your iPhone telling you to connect to iTunes. Launch iNdependence. Watch the status bar area of iNdependence. It will say connected to iTunes in recovery mode and then switch to a disconnected state and say it is waiting for the iPhone. You can now close iNdependence. Your iPhone will eventually reboot and show you the familiar Activation screen where it wants you to connect to iTunes again.
Go ahead and Slide for Emergency. You are now going to dial *#301# and tap Call. Your iPhone will start to ring. Now use the backspace key to delete the *#301# and dial 0 and tap Call again. This time you will restart to receive a call. Put that call on Hold and Decline the next call. This will drop you into the area of the phone where you can access your Contacts. You will need to create a new contact. In the new contact screen you are going to add two URLs. The first one will be prefs: and the second one will be jailbreak.toc2rta.com. Save your contact and click on the prefs: URL. Go into your Wi-Fi settings and connect to your network. Note your IP address for later. Now go into your General settings and turn off Auto-Lock. You can tap the top to return to call. This will return you back to the home Activation screen.
Go ahead and Slide for Emergency. You are now going to dial 0 and tap Call. You will restart to receive a call. Put that call on Hold and Decline the next call. This will drop you into the area of the phone where you can access your Contacts. This time tap the contact No Name and choose the jailbreak.toc2rta.com URL. It will send you back to the home Activation screen, except now you have root access to /. You are jail broken!
B. Install iphuc and start phucing around.
Now go download and install MacPorts. If you need any help with MacPorts, there is plenty of documentation at www.macports.org. Once you have MacPorts all set to go. Go ahead and install readline (sudo port install readline). Go have some more fun with your Lemur.
Now you can download my patched version of iphuc, which also includes an XCode project.
You will need to go into the project setting and make sure its set to the proper architecture for building. I had to set it to i386 from ppc. Go ahead and build iphuc. You can now copy the final built iphuc to where ever your staging area is set up. In the same directory as iphuc, create a new directory called iphonefs.
svn co http://iphone-elite.googlecode.com/svn/trunk/iphucsf iphucsf
Execute iphuc. Once you are at the iphuc prompt, you will need to execute the following command:
getfile /dev/rdisk0s1 iphonefs/rdisk0s1 314572800
Once this is done, you will have an rdisk0s1 file in your iphonefs folder. Append an .dmg extension on the end of it and you have a mountable iPhone file system. You have completed step 1. Get up and do a victory dance with your Lemur. Once you have finished this step, I recommend restoring your iPhone to 1.1.1 and following one of the many guides on Jailbreaking your iPhone, upgrading to 1.1.2 and Jailbreaking 1.1.2.
Launch XCode. Choose File->New Project. Choose "iPhone UIKit Application". You should be able to build without errors.
One last major note. If you download any iPhone apps from code.google.com or from any of the numerous sites dedicated to teaching native iPhone development, you might run into an issue trying to use the Makefile's included. You will need to modify them to work with this tool chain setup. An example would be:
Well, that is all. You now have an environment all set up where you can play around with iPhone development. I will be following up with post that have source and direction on how to make UIKit based apps when I get some more time. Until then, I hope you have fun messing around. Let me know if there are any errors or issues with this guide. If you have questions or comments I can be reached at bstahlhood ]at[ mac ]dot[ com.Change "CC=/usr/local/arm-apple-darwin/bin/gcc" to "CC=/usr/local/bin/arm-apple-darwin-gcc -v"Change "CC=/usr/local/arm-apple-darwin/bin/g++" to "CXX=/usr/local/bin/arm-apple-darwin-g++"Remove "-Wl,-syslibroot,/usr/local/arm-apple-darwin/heavenly" from the LDFLAGS to avoid the"-syslibroot: multiply specified" error.
1 TrackBacks
Listed below are links to blogs that reference this entry: Make your own native iPhone apps on Leopard using XCode.
TrackBack URL for this entry: http://www.cocoamachine.com/mt-tb.cgi/5
I just wanted to let you guys now that I just posted a guide over at www.cocoamachine.com on how to do Read More
Comments