Random Sequence

In iPhone OS, both Phone.app & Contacts.app are able to place special pins in Maps.app showing the location of a contact with a custom named pin & additional contact information in a detail view.

Below are my notes on replicating this functionality.

Sponsored Links:

iPhone Address Book & Google Maps Integration

Pins with Custom Titles

Google maps allows control of the title of a marker window by adding a title in parenthesise at the end of the URL, for example:
http://maps.google.co.uk/maps?q=edinburgh(Capital%20of%20Scotland)

As of iPhone OS 2.0.2, Maps.app disregards the custom title.

It is possible to place a pin with a title using co-ordinates rather than an address search, for example:
http://maps.google.co.uk/maps?q=Capital%20of%20Scotland@55.927663,-3.166809

As of iPhone OS 2.0.2, Maps.app shows ‘Capital of Scotland’ as the marker address, and again on the detail view.

How do Phone.app & Contacts.app do it?

Both use a specialised view provided by the Address Book UI Framework. Address Book UI Framework is part of Core Services.

Using the custom view, Address Book UI Framework opens the maps application using a special URL:

maps:address=%@&abPersonID=%d&abAddressID=%d

Where abPersonID is the UID of the contact and abAddressID the address. The first parameter is used to populate Maps.app’s search box.

To attach extra information to a maps.app pin you must create a record in address book, then display the detail view for that record.

Sponsored Links: