Opening MKMapItem In iOS Maps

iOS 6 has been out for a while. With each release, there are tons of new features added to the SDK. In particular, I would like to mention a new class – MKMapItem.

If previously you had to create a special Map URL to open desired address in Maps, with MKMapItem, this can be done in object-oriented way by creating an instance of MKMapItem and then simply sending it a -openInMapsWithLaunchOptions method.

There is more to it. In addition to being able to simply create and open addresses/coordinates in Maps, MKMapItem allows developers to launch Maps in turn-by-turn mode and provide turn-by-turn directions to its users.

Here is a quick example of how an address string is converted to coordinates, then MKPlacemark, and finally MKMapItem:

You can copy and paste this code into xCode, connect it to a button action and see the result.

Opening MKMapItem In iOS Maps