Monday, August 11, 2008

Running SDK apps on a jailbroken 2.0.1 iPhone [Updated]

Update: There is useful information in the comments about how to do this with later versions of the SDK as well. Thanks to everyone who has contributed. 


This summer I've spent some time working on my iPhone app, which I hope to release on the App Store later this fall.

Since I imported my iPhone from the USA, I have to use the iPhone Dev Team's Pwnage Tool to unlock and jailbreak it. I chose to stay on firmware 1.1.4 until 2.0.1 was available to avoid the performance issues that were widely reported. This means I have not had the opportunity to try my application on the phone itself, but last night I updated to 2.0.1 and tried installing the app.

It turns out my application works great, but I still need to add a few more features and spend some time generating nice visuals to replace the placeholder graphics I am using.

To get the application running on the iPhone I had to copy it using scp to the /Applications directory on the phone and bypass the iPhone Code Signature check. After some googling I found the ldid tool written by Jay Freeman, which takes care of the Code Signature.

Here are the steps I used to get my SDK developed app running on a jailbroken iPhone, all commands should be entered as one liners in the Terminal:

1. Make sure you set Xcode to compile for the device, not for the simulator.

2. Compile the project, then copy the resulting MyApp.app directory to the iPhone's /Applications directory.
mac# scp -r MyApp.app/ root@iphone_ip:/Applications/

3. Access the phone using SSH. The root password is alpine, at least on my phone.
mac# ssh root@iphone_ip

4. Make sure the executable is marked as such, this step is probably unneccessary but it wont hurt anything.
iphone# chmod +x /Applications/MyApp.app/MyApp

5. Install the ldid tool, this step probably needs Cydia to be installed on your phone.
iphone# apt-get install ldid

6. Run ldid on the application executable on the phone.
iphone# ldid -S /Applications/MyApp.app/MyApp

7. Your application icon should now turn up once the phone is rebooted.

These steps will work even if you have not been accepted to the paid iPhone developer program.

Note that these instructions are experimental. I can't be held responsible for whatever happens if you try them.

11 comments:

Francis said...

Thanks for that info, was just the info I needed. ;-)

darioco said...

I've been waiting a loooong time for apple to respond to my request to become a developer, thanks to this now i can test my app on the iphone.

Thank you, i hope my app gets published at some point.

mygoog said...

Great info.

I followed your steps exactly. But my app failed to appear on SpringBoard. My iPhone is v2.2 jailbroken with PwN 2.2.

Do you think that your method works for v2.2 of iPhone as well ? Have you tried ? Do you know how to debug it ? Where is the log ?

Thanks.

The Evil Boss said...

mygoog: Actually I have been meaning to update this post with some information regarding Mobile OS X 2.2.
I haven't tried this myself, but a friend of mine had success doing the steps above, but with the following tweaks.

- Your application must be compiled for OS 2.0, version 2.1 and later require certificates to build using Xcode.
- Instead of rebooting the phone you need to use the Respring app on the phone. I suppose it's available in Cydia.

Good luck.

mygoog said...

Thanks a lot, T.E. Boss.

Following your instructions, my first app amazingly appeared on my iPhone. Wonderful tip !

The Evil Boss said...

mygoog: Thanks for taking the time to let me know that the revised steps work. Good luck with your app, I hope to see it in the App Store in the future.

Maciej Swic said...

Hi,
i have tried both this method, and self-signing as described by saurik. However i still get the "The application xxx cannot be opened".

I have also tried downloading a free app from appstore, opening it and then restarting the phone.

I have also checked the dir prefs.

What should i do? I have a jailbroken and unlocked 2.2.1 iPhone 3G.

Thanks

Mattb said...

Great post, I've been banging my head on the wall over this one.

For those that are on 2.2, you can use a self signed certificate and get around the provisioning by doing this http://iphonesdkdev.blogspot.com/2009/01/how-to-skip-provisioning-profile-for.html

carlos said...

This works a treat, thanks. Please note also that, on 2.2, if you edit the file /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/SDSettings.plist you can disable the need for code signing.

Just change REQUIRE_CODE_SIGNING in this file to a value of 'NO'

Juan Basso said...

I tried and no look. I'm usign iPhone 2.2.1, XCode 3.1.2, building in Device 2.0 Release. I can copy (scp), make ldid -S in app and rebooted. The files on the system, but not showing anything in interface of iPhone. Suggestion?

The Evil Boss said...

Juan Basso:

As mentioned in the comments above I think you need to use the Respring app instead of rebooting your phone to make it appear in the interface.