iPhone Applications

So, I came upon an iPhone to play with for a few days and decided I should try to learn about how the user applications run on it.  There has been a lot of great work already by the guys on the iPhone Dev Wiki around getting SSH and such on the iPhone, needless to say without their work this discovery would not have happened.

The point was to learn how the applications are structured and then see if I could add an existing application back to the iPhone with a different name and icon and have it run. Today Fred and I set out to see if we could get this to happen.

 

iPhone applications look very similar to applications for OSX, makes sense as they both run some version of OSX.  The file structure of the iPhone Calculator is this:

[/Applications] [/Calculator.app] Calculator CalculatorBackground.png Default.png [/English.lproj] InfoPlist.strings Localizable.strings Info.plist LCDBackground.png PkgInfo icon.png ring.png

[ source: iPhone Directory listing ]

For this example we will be trying to change the calculator app into some a touch more fun looking.  First step is simple ( if you already have SSH on the iPhone and the binkit on your iPhone)  tar up the Calculator app and copy it to a Mac.

Executable [Calculator]

The Calculator file is a compiled binary for the ARM platform running it from OSX produces the error message: “Bad CPU type in executable.”  We assume that this has something to with the Universal application concept in OSX.  It is opening that executable and looking to see if it has the ability it talk to an Intel/PPC processor it of course doesn’t so it craps out.  First thing we did was to rename this file to foobar.

Info.plist

This is the file that has all the information about what to execute when a user clicks on the icon in the home screen.  File is a regular plist file from normal OSX applications.  The node to concern yourself with is CFBundleExecutable.  This points at the binary you want to execute.  So, in our case we need to point this node at our renamed executable.

icon.png

A few sites have already figured out you can change these around so, I won’t go into anymore detail then pointing you at the ModMyiPhone wiki that describes the structure of iPhone pngs.  You don’t actually need to “optimize” your pngs for your iPhone.  It can render regular ones just fine.  We threw a “festive” graphic into our package.

“Deploy”

The final step is to move all these files over to the iPhone.  Make sure you get the directory structure right:  /Applications/foobar.app/ .  Reboot the phone and you should see your newly renamed and functioning Calc application on the home page.

IMG_1550

One other interesting that came of this is that the iPhone can’t have more then 16 applications on it.  The home screen does not have the ability to scroll.  We loaded 4 more copies of the calculator onto the phone and were unable to scroll down to see them.  Maybe there is a simple change to the launcher application to allow the scrolling to happen or maybe Apple has to change the application to allow it.

IMG_1551

You can see the little Handbrake icon peeking out from under the Buttonbar, but you can’t scroll down to see it.  Sad.

No, this isn’t a new native application but, it gets us one step closer to deploying applications onto the iPhone once we can compile them, which is still a long way off.

4 Responses to “iPhone Applications”

  1. jackie Says:

    I’m going to buy one. It is very useful info. I’m envious!

  2. Marshall Says:

    hi i enjoyed the read

  3. Google Magic Formula Says:

    1 4 google magic formula…

    Google Magic Formula…

  4. Muhammad Ali Says:

    I’ve made an application with exactly same directory structure. iPod Touch loads the application but just displays the background image and after sometime returns to the home page. Any guesses where I might be wrong?

Leave a Reply