Easy iPhone UIKit Development and Deployment with XCode 3.0 iPhone Template

| | Comments (7) | TrackBacks (0)

Here is the guide to set up everything you need to use the XCode template with SSH deployment on build.  When you are all set up, you can just build your application, it will copy the .app to the iPhone and restart Spring Board.  Please make sure you have BSD Subsystem and OpenSSH installed prior to doing the following steps.  You will also need the iPhone tool chain built on Leopard to do iPhone development.  See my earlier post.

1.  Setup SSH.

Open Terminal

ssh-keygen
Hit Enter at the "Enter file in which to save the key" prompt.
Enter your passphrase.
cd ~/.ssh
cat id_rsa.pub >> authorized_keys

SSH into your iPhone.
mkdir ~/.ssh
Copy the authorized_keys file over to the ~/.ssh directory on your iPhone.

On the iPhone, perform the following:

chmod 755 /var/root
chmod 700 /var/root/.ssh
chmod 644 /var/root/.ssh/authorized_keys

2.  Set up environment variable on your Mac. (This is just one of many ways).

mkdir ~/.MacOSX
Open Property List Editor and create a new Property List.  Add a new node and call it IPHONE_IP.  Class String and put your iPhone IP address in the value.  Save as ~/.MacOSX/environment.plist.  Reboot.

3.  Download and install the XCode template

Download the template and follow the README for install instructions.  Create a new app and do a Build.  XCode will prompt you for your passphrase if everything is setup correctly. Enter your passphrase and save to keychain.  You are all done.


Have fun coding and deploying your iPhone apps!

0 TrackBacks

Listed below are links to blogs that reference this entry: Easy iPhone UIKit Development and Deployment with XCode 3.0 iPhone Template.

TrackBack URL for this entry: http://www.cocoamachine.com/mt-tb.cgi/7

7 Comments

moc said:

Hi I tried this on my ipod touch. I can get my ftp app to use the password I set up, but I can never get Xcode to do it. Not sure what I can do to fix that.

@moc

Is your iPod Touch using the latest 1.1.2 and OpenSSH install? Can you provide me more details? You can reach me at bstahlhood ]at[ mac ]dot[ com.

Skitals said:

Hey, thanks for all of this. I got the toolchain and template installed per your guide. It seems to be working, and can succesfully build a test app. The problem is it's not getting deployed to my device. It seems like it SHOULD be working, because I get ssh warnings when my device is off, but when it's on and compiles succesfully, SpringBoard never restarts and no files are transferred to it.

Is there something I'm missing?

joej said:

This template is great! I added modified the Makefile to 1. detect if the IPHONE_IP is reachable 2. only kills SpringBoard if the Application did not exist.

if ping -t 1 -c 1 $(IPHONE_IP) ; then ssh root@$(IPHONE_IP) '[ -d /Applications/$(PRODUCT_NAME).app ] && echo Application exists on iPhone || touch ~/.xcode_kill_sb'; scp -r $(APP_ABS) root@$(IPHONE_IP):/Applications; ssh root@$(IPHONE_IP) 'if [ -e ~/.xcode_kill_sb ]; then rm ~/.xcode_kill_sb; killall SpringBoard; else echo skip killing SpringBoard; fi'; else echo iPhone not available; fi

zach Author Profile Page said:

Forgive a complete newbie question. I successfully jailbroke by 1.1.3 iPhone, installed OpenSSH and my keys. I can ssh from the terminal no problem.

I built the toolchain and I didn't seem to have any trouble there.

The XCode template doesn't seem to be able to connect to the phone, but that's actually not my question.

I don't mind copying my app manually to the phone, but where is Foo.app when I build? I've got a Foo.build directory, but how do I get the actual app bundle?

I looked in the XCode manual and it suggested that I should be using xcodebuild from the command line with the 'install' option, which seems to work with a regular Cocoa Application, but not with the iPhone UIKit Application.

Many thanks for your valuable articles.

zach Author Profile Page said:

Ok, I should have done a little more looking around. I was thrown by the fact that my build directory has Foo.build in it. I found what I was looking for in build/Release/Foo.app

Cheers!

jguru said:

Hi,

Do we have to downgrade to 1.1.2 ? I am using an iPhone with 1.1.4 with ziphone jail-broken and I can ssh into my device.. does the instructions still work?

Leave a comment

About this Entry

This page contains a single entry by Ben S. Stahlhood, II published on January 6, 2008 9:02 PM.

iPhone XCode Template was the previous entry in this blog.

iPhone XCode 3.0 Template Update is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages