views:

27

answers:

1

I currently have an application which will drop pins onto various points of interest on a map, all done programmatically on the iPhone.

What I am aiming to get done now is to allow a user to navigate to that location and get turn by turn directions by calling up the built in navigation tools on the iPhone.

Is there anyway that I can do this? I've scoured the developer center and searched both google and here and couldn't find anything about this.

A: 

You're not allowed to use google directions within your app. The only way you can do this is to send them to the google maps application as per:

- (void)getDirections {
    CLLocationCoordinate2D start = { (startLatitude), (startLongitude) };
    CLLocationCoordinate2D end = { (endLatitude), (endLongitude) };

    NSString *googleMapsURLString = [NSString stringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f&daddr=%1.6f,%1.6f", start.latitude, start.longitude, end.latitude, end.longitude];

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:googleMapsURLString]];

}
Thomas Clayson
I've tried the code you posted and it opens a browser. While it does get me closer to my goals, I did find an application which opens up the native map search tool here :http://itunes.apple.com/us/app/rutters-store-finder/id329882310?mt=8 .
BOMEz