Writing iPhone applications for jailbroken iPhones

As a developer I don’t enjoy paying for things when I don’t have to. One of them happens to be Apples iPhone Developer program. I could find better ways of spending $99. Debugging my own stuff isn’t one of them. So what is a developer to do when he can’t or won’t pony up the money to be allowed to load and debug his own applications. He uses that tiny developer brain to bypass all the checks that’s how.

I’m not going to go into the ins and outs of jailbreaking the iPhone. There are plenty of tutorials on the net to do exactly that. If you are in over your head at this point you should probably bail now, shit is definitely not going to get easier from here on out.

Creating a certificate

You’ll need your own self-signed certificate. iPhone OS will check for it, jailbreaking will tell it that it’s good, regardless of who it came from. So crack open Keychain access and create one for yourself. It’s in /Applications/Utilities/Keychain Access.app. From the menu choose Certificate Assistant > Create Certificate.

keychain_access_1.png

Give it the name “iPhone Developer” and check overide defaults.
certificate_1.png

Give yourself enough time. 10 years sounds about right. And change the type to Code Signing.
certificate_2.png

Add as much or little information as you want to the personal information screen.
certificate_3.png

After here, click next until the end. It should be shown in your Keychain Access application list.
keychain_access_2.png

Update the Developer stack

We’ll need to make a modification to the Info.plist of the SDK. Go to /Developer/Platforms/iPhoneOS.platform. Create a backup of Info.plist and open the original in Property List Editor. Change all instancese of XCiPhoneOSCodeSignContext to XCCodeSignContext. There are 3 instances of them in SDK 3.1.2. There might be more or less in future versions.

Back to XCode

In XCode open your project and change the Active SDK to iPhone Device – 3.1.2. Run the build command with Command-B. Go to the Directory with your project, open the build folder and into the Release-iphoneos or the Debug-iphoneos folder you’ll find the executable. We’re going to need to get this file into the iPhone.
project_folder.png

Copy your application to iPhone

You won’t be able to get your application onto the phone using the normal channels. iTunes won’t allow it. So the alternative is to copy it to the phone using SSH or iPhone Explorer. As with all things Mac, iPhone Explorer provides a GUI. And a GUI is always handy. Using iPhone Explorer go to the /Applications folder on the device. And upload your app folder. When complete it should appear like this. In some cases the app won’t be set to executable. If this is the case you’ll need to run the “chmod a+x” on the app folder to allow it to run.
explorer.png

Your application won’t be present on the springboard. For that you’ll need to restart the springboard. There are jailbreak applications that allow for this. You can also install the UIKitTools and run uicache from the commandline to update the springboard without restarting it.

Reblog this post [with Zemanta]