Running Two or More Versions of Xcode for Stable/Beta iPhone Development

This is a simple but useful tip for people like myself who want to stay up to date with the latest beta releases of the iPhone SDK, but who also rely on having a stable version of the SDK installed for things like deploying to the App Store, reproducing bugs from in-the-wild, or client work that doesn’t take advantage of any new SDK features.

Read on →

Configuring Multiple CalDAV/Google Calendars on iOS 3.0

One of the cool features of Leopard was the addition of CalDAV support to iCal, which allows you to read/write/edit/delete calendars hosted by third parties like Google Calendar. Similar functionality was available on the iPhone, but only via Apple’s MobileMe service. That’s changed with iPhone OS 3.0.

If you’ve configured a bunch of CalDAV calendars in iCal, unfortunately they’re synced to the iPhone as read-only calendars which is a real pain. In lieu of a fix by Apple, we’ll need to remove the iCal CalDAV accounts from the iTunes calendar sync list, and configure them on the iPhone itself.

To set up a new CalDAV account, you’ll need to navigate through the following screens on your iPhone:

SettingsMail, Contacts, CalendarsAdd Account...OtherAdd CalDAV Account...

Once you’re there, you’ll be presented with a dialogue that lets you enter a CalDAV server, username, password and description. This dialogue is incredibly misleading, because the “server” field will not only accept a hostname like “”, but also a full CalDAV URL like<CALENDAR_ID>/user. If you’re using Google Calendar with only one calendar, enter your Google Calendar credentials like the following example:

If you’ve got multiple CalDAV calendars, it starts to get a little bit hairier. Initially, I emailed myself a list of my CalDAV URLs (4 in total) and used the new copy-paste features to manually configure each account using the previous instructions, only instead of using “” in the server field, I pasted the entire CalDAV URL instead. As you can imagine, this is incredibly tedious.

Fortunately Apple also released a new version of the iPhone Configuration Utility (ICU), which is a really handy tool for creating iPhone configuration bundles for deployment in enterprise environments. Among other things, this new version allows you to configure CalDAV accounts. If you haven’t already, you should grab a copy of ICU for Mac OS X or Windows.

Launch ICU, create a new configuration profile, and open the CalDAV pane. For each CalDAV calendar you want to configure, you’re going to want to fill it in like this:

If you’re looking at the Principal URL field and wondering what is, you’ll find it in the calendar settings page of Google Calendar under Calendar Address (it should look like an email address).

Once you’ve entered all your CalDAV accounts, plug in your iPhone, select it in ICU and open the Configuration Profiles tab. You should see the configuration profile you just created, with an “Install” button next to it. Hit the “Install” button.

You iPhone should show a screen like this:

If you hit “More Details”, you’ll see the CalDAV calendars listed:

Hit “Install”, confirm, and open up the Calendar App to see if everything works as expected. You should be able to create, edit and delete calendar entries in your CalDAV accounts, and have them update in iCal / Google Calendar. If you ever want to add a new CalDAV calendar, I think you need to remove the configuration via the iPhone Configuration Utility and re-install the edited configuration bundle.

Hopefully it doesn’t take too long for Apple to make the CalDAV integration between iCal and the iPhone more seamless.

Enabling Internet Tethering via Optus/Virgin/Vodafone/Telstra on iOS 3.0

UPDATE: Due to changes in the public release of iTunes 8.2, you will now need to quit iTunes and run a command in your Terminal before proceeding with the instructions below. The command is: “defaults write carrier-testing -bool TRUE”.

UPDATE: I’ve downloaded the Telstra and Vodafone bundles and made similar modifications, so they’re now available in the guide. If you’re using Telstra/Vodafone and my modified settings bundles work, please let me know in the comments as I’m unable to test it myself.

The following instructions are intended for members of the Apple Developer Connection (ADC), running an iPhone with a developer version of the iPhone OS 3.0 software. This guide also only provides Australian carrier settings for Telstra, Vodafone and Optus (plus resellers like Virgin), but if you follow the link to Crunchgear in the first step there are instructions on downloading and modifying the carrier setting bundles.

  1. Download Telstra_au.ipcc, Vodafone_au.ipcc or Optus_au.ipcc, which were created as per the AT&T instructions on Crunchgear (note that the file should have an “.ipcc” extension, not “.zip”. If your downloaded file has a “.zip” extension, unzip it to produce a “Carrier_au.ipcc” file)
  2. Open iTunes
  3. Plug in your iPhone
  4. Select you iPhone under devices
  5. In the Summary tab, ⌥-click (option-click) the “Check for Update” button
  6. Select the previously downloaded Telstra_au.ipcc, Vodafone_au.ipcc or Optus_au.ipcc file and click “Open”
  7. Once the settings have been copied, disconnect your iPhone
  8. Restart your iPhone
  9. Open the Settings application on your iPhone, and navigate to General, then Network, and finally Internet Tethering
  10. Turn Internet Tethering on. At this point, tethering is now possible via USB when your iPhone is plugged in. If you’d like to use Bluetooth, continue reading
  11. You will be prompted to turn bluetooth on if it’s not on already. Select yes if prompted
  12. On your laptop, turn on bluetooth and open the Bluetooth Preference pane
  13. Click “Set Up New Device…”, which will open the Bluetooth Setup Assistant
  14. Select “Mobile Phone” as the Device Type
  15. Select your iPhone from the device list
  16. A number should appear on your laptop, and your iPhone should prompt you for a pin
  17. Enter the pin from your laptop into your iPhone
  18. Once paired, make sure you keep “Use device as network port” selected
  19. In the Bluetooth Preference Pane, make sure “Show Bluetooth status in the menu bar” is selected, since it makes things easier for starting and stopping tethering
  20. Click the Bluetooth icon in your status bar, where you should now see your iPhone under devices
  21. Click on the menu item for your device, and select “Connect to Network”
  22. On your iPhone, you should now notice that the top of the screen has a blue bar titled “Internet Tethering”
  23. You can now use the Internet!
  24. As an optional extra, you can open Network Preferences and rename the two new network devices to “iPhone USB” and “iPhone Bluetooth”

Not really a difficult process, but it can be a bit fiddly. Downloading my preconfigured files also saves mucking around in Property List Editor, which most people will attest is a bit of a pain.

“Chunked” Transfer-Encoding Support in Apache/Passenger

I wrote an article last year about the lack of Apache support for HTTP requests with the “Transfer-Encoding: chunked”. Of course, this problem really only affects those of us who use Apache modules that were developed against the Apache 1.3 API (pre-HTTP 1.1). One such module was Phusion Passenger — also known as mod_rails — which I was using at the time to provide a web service to J2ME MIDlets and an iPhone application (among other things). To get around the lack of support, I presented a solution involving the use of mod_proxy to buffer the chunked request and rewrite it as a new request before passing it to the non-HTTP 1.1 compliant backend.

Thankfully as of two days ago, that hack is no longer required if you’re using Passenger.

Hongli Lai (the lead developer of Phusion Passenger) has checked in a change that enables support for chunked transfer-encoding, which means no more dreaded HTTP/1.1 411 Length Required responses. So the fix is checked into the tree, and according to the bug report will be made available in the next release of the Passenger gem — version 2.1.4.

Configuring Apache to accept chunked HTTP requests from J2ME (CLDC and MIDP)

A few months ago, I wrote an article describing a solution for accepting chunked HTTP requests made by J2ME devices to non-HTTP 1.1 compliant servers unable to accept such requests (Mongrel, Lighttpd, Nginx etc.).

One of the commenters was concerned that J2ME developers suffering from this problem might find it difficult to find my article since I didn’t really mention J2ME MIDlets much at all. So, if you’re a J2ME developer suffering from problems like those described here, here or here…check out the original article for a simple solution.