Thursday 13 January 2011

Installing an archived application to an iPhone from XCode Organizer


The organizer window in Xcode has a handy feature where all the versions of applications you have submitted to the App Store are listed.
Today I needed to install an old version of an app to my iPhone in order to reproduce an issue a customer was having. It wasn’t as easy as I was expecting so I thought it was worth recording the process. Essentially you cannot simply copy the archived app to your device manually, as it was signed using the App Store certificate. We need to re-sign it using an Ad Hoc certificate instead - then it’ll run.
First up you need to make sure that you have an Ad Hoc distribution certificate handy, and that said certificate includes the device that you’re trying to distribute to.

UPDATE: August 2012: This process is far easier if you use this free open-source app called iResign.  This great app lets you take an existing IPA and re-sign it with your own certificate. Much, much simpler

Making the Ad Hoc Certificate
Ignore this part if you already have an Ad Hoc distribution certificate.
  1. Get your team agent to log into the iOS provisioning portal
  2. Go to provisioning / distribution tab
  3. Hit New Profile
  1. Choose ‘Ad Hoc’ as the distribution method
  2. Choose the relevant app ID (I chose an app id that allows any application by Calvium)
  3. Select the devices you want to be able to run on. I just chose all by selecting the select all button.
  4. Hit ok. Wait a minute or so, and hit refresh to be sure that the certificate is ready.
Re-signing the app using the Ad Hoc Certificate
  1. Go back to Xcode organizer. Open the ‘archived application’ section and choose the app you want to use.
  2. On the right-hand panel, choose the version to use. I’ve chosen 1.2. Apologies for the censorship in the images here..
  1. Click Share
  1. Click the ‘identity’ drop-down and under the heading ‘Ad Hoc Distribution’, select ‘iPhone Distribution’
  2. Now click ‘Save to Disk’
  3. Choose a filename (doesn’t matter what it is)
  4. Xcode will grind away for a bit re-signing the app, and then save a .ipa file containing the app.
Installing the app on your device (the .ipa file)
There are various ways of installing the ipa on the device, including via iTunes. I find this method by far the easiest - no syncing required.
  1. Open Xcode organizer again
  2. Attach the device
  3. Open the ‘Devices’ section, and select the device
  1. Under the Applications box, click the + arrow.
  2. Select the .ipa file you just saved, and lo and behold the app will be installed
  3. If it fails with an ‘no provisioning profile found’ or ‘invalid entitlements’ or similar, check that the ‘Provisioning’ box above contains the Ad Hoc profile you created earlier. If not, download it from the iOS provisioning portal, and manually upload it by clicking the + button under provisioning.

Screen sharing on Mac OS X Server using VNC

Chicken of the VNC is a free open-source Mac application that allows you to view a remote desktop on another networked machine.

Here's how I set it up on my Mac running 10.6, and our Mac Server (10.6 too).
  • Run Server Admin on your local machine
  • Open up the server you want to connect to
  • Select Firewall.
  • Go to Settings / Services tab
  • If 'Allow traffic only to these ports' is selected we need to add the ports that VNC will use.
  • Click the little + button at the bottom-left of the list of services
  • Add a new service called VNC 1, using port 5800, TCP + UDP
  • Add a second service, VNC 2, using port 5900, TCP + UDP
  • Stop and restart the firewall
  • Download Chicken of the VNC and install it.
  • Run the app
  • Go to Connection / New Connection
  • Enter the IP address or name of your server
  • Leave 'display' as 0 (if you choose 1 you'd have needed to open ports 5801/5901 above for example)
  • Leave 'profile' as 'default profile'
  • Check the 'save server' box.
  • Hit connect.
If all goes well you should have a window pop up displaying the screen of the server.