I am trying to launch the maps app from my iPhone SDK app. Right now I can launch the maps app with directions but it goes to an overview of the directions and doesn't use Siri and the voice navigation to give turn by turn directions.
currently I have a button that launches this code...
NSString *address = viewedObject.addressFull;
NSString *url = [NSString stringWithFormat: @"http://maps.apple.com/maps?saddr=%f,%f&daddr=%@", here.latitude, here.longitude, [address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
I built ontop of progrmr's answer above...the code below will take a NSString input of an address then forward Geocode it and then open the Maps app with voice navigated directions to the NSString input. The NameString and PhoneString get attached to the placemark put on the Maps app. The code below would not be possible with out progrmr's code above, please mark his answer as useful.
With iOS 6 there's a new way to launch maps, using
openMapsWithItems:
inMKMapItem
. Here's a snippet that I use that provides walking or driving directions from current location to the provided coordinates:The way you are doing it, which you still have to do if running on pre-iOS 6 devices, you need to include the
dirflg
in the URL to request walking or driving directions: