Posts Tagged “setup”

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; launchctl load;
  • 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; launchctl load;
  • Delete the coresponding entries in User/Library/Caches/

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 Comments Off on iPhone developer setup

I worked a lot last months. Got me some $$. So I finaly decided to get myself a present. So here I am with my new iPhone.

It’s a nice device. Nice handling etc, as can be read on a lot places online. First thing to do is to jailbreak it. Easy done if one don’t cares about unlock the SIM. The usual tool to do so didn’t worked with my macBook, due to some weird stuff with the USB. Easy Solution: boot into Windows. Job done.

I got 2 Apllication installers then, Cydia and Installer. I use Cydia because its open source and has thousands of repositories out in the net. Most important was to get a useable way to access the System. Terminal is a nice app from Cydia that offers – drums – a Shell. For sure its limited. But it works, just be carefull with commands that dont finish in some cases (eg, don’t ping or if so, start in background!).

A easier way to access the iPhone is trough ssh.

First i setup my laptop to offer WLAN. To make Things easier, i just setup internet sharing on my WLAN. This way the iPhone can access the net too. Connect to it from the iPhones Settings app. Use ifconfig to find the IP. The usual setup of the network with connections haring should give the iPhone the same IP from now (at least if you connect it to the wlan frequently).

The only login available at this time is the root which has a preset password of alpine. Since this is a public and known default (note to my evil hacker self: Check out public hotspots at train Stations and alike for accessable iphones).

Using this, login to the iPhone. Note roots home Directory (pwd), its /var/root. Now this is a good place to start poke around with the iPhones internals. I will talk about this in a later Post. For now we setup the ssh login in a more convient way.

All my used User Accounts have a RSA-identity. I use those to allow key-based logins on all my computers. So first I go create one for my iPhone. The iPhone actualy has 2 users we need care about. root and one called mobile. For root we place the keys into /var/root/.ssh/, mobiles stuff goes to /var/mobile/.ssh. Adding all my computer public keys to the authorized_keys file for both accounts, and add the public keys of both accounts to all my computers. Now I can login from all my computers to the iPhone and reverse too.

I too have setup my home server to more easy open tunnels from extern. The iPhone was added too to my home-network (not the one from my laptop). I too setup my Gateway (the macMini Server) to enable easy tunneling to all internal hosts.

Since I installed FUSE on my Laptop, i now can access the iPhone trough sshfs, allow me to use the iPhone like any local harddisk.

Last step would be disable the password login on the root account on my iPhone, but first i want make a simple script to turn it on again, which i can run from the iPhone console in case of emergencies.

Flattr this!

Comments Comments Off on new iPhone