Well, Apple wants 99$ to let one develop for the iPhone. I would even pay that, but they wont sell it wihtout me have a credit card. And that is a definitively no-go for me.

So how to enable iPhone development for me?

Preparations :

  • Xcode :
    Xcode comes with 2 sets of SDKs for the iPhone. The Simulator- and the Device-SDK. The simulator-SDK is intended to run apps on the integrated iPhone simulator. This works out of the box. We talk about some problems with the Simulator later.
    The more tricky thing is to build for the Device. Apple wants all iPhone Apps be signed (a good idea actualy). Aproved Developers (those who pay to Apple) get a Code Signing Certificate and other Stuff from Apple. People like me without this need create that ourself.

    • Create a Code Signing Certificate
      The most convient way is to use the Keychain Manager that came with osx. Use the Assistant in the Programm Menu to create a Code Signing Certificate. By default Xcode checks for a Certificate issued to “iPhone Developer”, so use that as the common name. No need to adjust all the Projects then.
      If Xcode can’t get your Certificate you get a message
      CodeSign error: Code Signing Identity 'iPhone Developer' does not match any code-signing certificate in your keychain. Once added to the keychain, touch a file or clean the project to continue.
    • Open file:///Developer/Platforms/iPhoneOS.platform/Info.plist and add to the OverrideProperties those 2 keys:

      Without this, you get Errors like
      CodeSign error: a valid provisioning profile is required for product type 'Application' in SDK 'Device - iPhone OS 2.2.1'

    • You must restart Xcode to make those changes work.
  • iPhone setup:

Get your Application to iPhone

  • Build your project for iphone. Double check the SDK set.
    You will see a warning:
    CodeSign warning: provisioning is not applicable for product type 'Application' in SDK 'Device - iPhone OS 2.2.1'; ignoring...
    Ignore it.
  • scp -r [-P <port>] <ProjectRoot>/build/Release-iphoneos/<AppName>.app root@<iPhone ip>:/Applications/
  • ssh into your iPhone; ssh -lroot [-p port] <iPhone ip>
  • To make the application apear on the display, we need reload the SpringBoard. The SpringBoard is the main application you usualy see. We use the internal launchctl application for this :
  • cd to the launchctl directory :cd System/Library/LaunchDaemons/
  • reload the Springboard: launchctl unload com.apple.SpringBoard.plist; launchctl load com.apple.SpringBoard.plist;
  • The iPhone beeps, and after sliding the lock away, your application should be there.

Remove Application

  • ssh into your iPhone, cd into /Applications
  • rm -r <ApplicationBundle>.app
  • reload the Springboard: launchctl unload com.apple.SpringBoard.plist; launchctl load com.apple.SpringBoard.plist;
  • Delete the coresponding entries in User/Library/Caches/com.apple.mobile.installation.plist

Ranting about the Simulator.

So Apple decided to let non-apple-aproved-developers have a way to legaly develop for the iPhone. We shall use the iPhone Simulator. This piece of Software is realy a nice thing, at least i don’t have to set my Application up on the phone, i can use my Keyboard, Mouse, etc.

Well, it would be nice… if its desing wouldnt be completly flawed. First of all it doesnt realy Simulate a iPhone. No arm. It uses x86 code. It uses another SDK. It actualy looks like it just calls the osx frameworks. Unfortunately this differs a little from the iPhone one. An example would be NSTask. On the simulator its there, on the iPhone its not. All this makes the simulator more of a trap than a usefull tool. You can never be sure your code will work on the iPhone just because it worked on the simulator.

Reloadin the Springboard doesnt always work. Im still unsure what the Problem is.
However, there is a simple workaround. install or remove a Cydia application. Note to myself: poke around in Cydias source to find the problem. This can be annoying after some time, so the most easy thing is to setup your own apt repository. This way you can even install applications from abroad!.

Flattr this!

Comments are closed.