inicio mail me! sindicaci;ón

Running your own iPhone applications without paying the developer fee

For those of you wanting to build off-line, native applications for the iPhone / iPod Touch (with the 2.0 Software Update), you might have been disappointed to hear you need to shelve out $99 yearly for the privilege of being able to run your applications on a real iPhone.

Ok, $99 might not be a lot, but one also has to consider when you come to deploy your app for real, it might not pass through the rather stringent screening process to get it to the masses through the App Store.

Wouldn’t it be great if you could deploy any application you wanted for free?

Well thanks to the recently released pwnage tool, it’s now possible to run non-Apple-approved applications on your iPhone though “Jailbreaking”. I’ve spent quite a while trying to figure out how to get this working. Here’s what i have come up with so far.

First of all…

If you are not using a Mac, or you don’t have the iPhone SDK installed, or alternatively the “open toolkit”, then these instructions will be of no use to you.

If you haven’t done so yet, Jailbreak your iPhone / iPod touch via the “pwnage tool”. For reference, this is what i did:

  1. Download the pwnage tool
  2. Create and transfer Jailbroken firmware using the pwnage tool

After you’ve done all that, you’ll probably notice a new application called “Cydia” appears on your iPhone screen. This is basically the way end-users can access a wide range of free “homebrew” applications on their Jailbroken iPhone’s. If you want to deploy your application to end-users, you’ll have to get it into Cydia.

But enough about Cydia for now…

I’ve built applications, how on earth do i get them over to my iPhone?

If you are using XCode, make sure you set the SDK of your application to “Device – iPhone OS 2.0″ (or the equivalent if it exists). Then all you need to do is click “Build and go”, and your application should appear on your iPhone.

Now you’ll probably get this rather “Unexpected error” popping up if you try and run your application with XCode.

Unfortunately while the pwnage tool allows you to run any application, that application still needs to be signed. So how do you sign it? Well, the best tutorial for that i have found is the “Code Signing Guide” on Apple’s website.

You’ll need to make a self-signed certificate using the Keychain Access utility. Then you should run the following commands in a terminal on your built application:


export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform//Developer/usr/bin/codesign_allocate
codesign -fs "Name of your certificate here" /Path/to/your/built/application.app

Unfortunately even when you do this, you still cannot run your app using XCode, so you can’t use any of those fancy debug tools with it.

In order to run your application, you’ll have to copy it over yourself. You can either use OpenSSH (installed through Cydia), or iphonedisk. I used OpenSSH, as i had problems with the permissions not being preserved with iphonedisk:


scp -r /Path/to/your/built/application.app root@address_of_your_iphone_or_ipod:/Applications/

Re-load the springboard either by installing something with Cydia, or restarting your iPhone. And hey presto, your app appears!

Update: There is now a way to get your apps working directly from XCode. Simply follow the instructions here, and you should be able to debug your application straight from XCode. Neat!

Note: there are of course other ways to get your app working, but personally i found signing it to be the most obvious.

Right, now my application is ready for public consumption

Great! So how do we get it into Cydia? Well there are two options:

  1. Get the Cydia guy’s to host it in their repository
  2. Make your own repository

Well i couldn’t figure out how you are meant to contact the Cydia guy’s to get your application in their repository. Realistically speaking, this is the only way people are going to find your application, considering there is currently no user friendly way to add new repositories to Cydia.

After all, would you really want to type all of this into the terminal to add a single repository?


ssh root@address_of_your_iphone_or_ipod
echo "deb http://location.of/apt_repository/ ./" > /etc/apt/sources.list.d/apt_repository.list

To conclude

If you are really serious about making money off developing iPhone apps, then i’d cough up and pay the $99 developer fee. That way you’ll be able to target every iPhone / iPod Touch user, while being able to charge a fee for downloading.

If however you have an application Apple are never going to distribute (e.g. emulators), or you are just playing about and don’t mind the lack of XCode integration for on-device debugging, then developing for Jailbroken devices is for you. Personally though i’d recommend you compile your own “open toolkit”, as developing your own unofficial apps using the official SDK is legally questionable.

  • Andrew
    Hi I found this .. wouldn´t this mean that you dont need to manualy copy the app to the phone ?

    A quick way to sign your apps:

    1) create a code signing certificate, e.g. iPhone
    2) in your XCode project, under targets: add new build phase -> new run script build phase

    for shell you can leave /bin/sh
    for script, enter:

    CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate codesign -s iPhone -f ${TARGET_BUILD_DIR}/${EXECUTABLE_FOLDER_PATH}/${EXECUTABLE_NAME}

    That's it! The only thing to replace in the script is the certificate name (e.g. iPhone)
  • James Urquhart
    Andrew,

    Now i tried that, but just couldn't get it to work properly. Even though i sign my app, XCode still complains that it can't verify the app. So i have no idea what is going on there. Seems like the only way i can get it working is copying it over manually and running sans the debugger. :(

    Btw, thanks for the correct run script. Was having trouble getting that correct. :)
  • Andrew
    Here is a how-to for Making Build & Go work + debuggning

    http://www.246tnt.com/iPhone/#xcode

    personaly i´m not to fancy with patching the mobileinstallation och spring bord .. but it works ..
  • James Urquhart
    Thanks Andrew, just updated the post to reflect this. Patching is annoying, yes. But well worth it, IMO.
  • flo
    hey ... I really don't want to patch springboard, especially w/o knowing if this also works with more recent firmware versions ... I'm currently running 2.2, but the guide mentioned at http://www.246tnt.com/iPhone/#xcode says it was only tested on 2.0 and a lot has changed since then ... so did anyone test it on 2.2?
  • James Urquhart
    Not tried with 2.2, considering i coughed up and paid $99 for a real development sdk.

    Still, i don't see the harm in patching. If it doesn't work you can just restore...
  • What I can say is very nice and helpful as well as informative post...really help me very much more!! Thanks..
    Cheers,
    Buat Duit Dengan Blog
blog comments powered by Disqus