How can I launch the Google Maps iPhone application from within my own native application?

For iOS 5.1.1 and lower, use the openURL method of UIApplication. It will perform the normal iPhone magical URL reinterpretation. so

[someUIApplication openURL:[NSURL URLWithString:@"http://maps.google.com/maps?q=London"]]

should invoke the Google maps app.

From iOS 6, you’ll be invoking Apple’s own Maps app. For this, configure an MKMapItem object with the location you want to display, and then send it the openInMapsWithLaunchOptions message. To start at the current location, try:

[[MKMapItem mapItemForCurrentLocation] openInMapsWithLaunchOptions:nil];

You’ll need to be linked against MapKit for this (and it will prompt for location access, I believe).

Leave a Comment