Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn by Turn navigation using Maps in iOS

Is it possible to get the turn by turn navigation using iOS Map Kit / Google Maps API or by launching iOS Maps /Google Maps with start and destination provided ?

like image 374
Siva Avatar asked Mar 05 '26 12:03

Siva


2 Answers

The following code opens the native maps app with directions from the current location to a specified location. (Using Latitude & Longitude)

double latitude = **>>Your latitude<<**;
double longitude = **>>Your longitude<<**;



MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake(latitude, longitude) addressDictionary:nil];

MKMapItem *mapItem = [[MKMapItem alloc] initWithPlacemark:placemark];
[mapItem setName:**>>Title of your desitnation<<**];

NSDictionary *options = @{
                          MKLaunchOptionsDirectionsModeKey:
                              MKLaunchOptionsDirectionsModeDriving,
                          MKLaunchOptionsMapTypeKey:
                              [NSNumber numberWithInteger:MKMapTypeStandard],
                          MKLaunchOptionsShowsTrafficKey:@NO
                          };

[mapItem openInMapsWithLaunchOptions:options];
like image 142
Out of Orbit Avatar answered Mar 07 '26 00:03

Out of Orbit


If you want it to happen within your app you have to obtain the directions list (http://www.techotopia.com/index.php/Using_MKDirections_to_get_iOS_7_Map_Directions_and_Routes) and implement the turn-by-turn directions process yourself .

I am sure that Google Maps SDK prohibits such use by its license terms. I think however that you can do it with MapKit. There also many other online routing services.

You can always simply redirect the user to the Maps app. It's very simple but the user gets away from your app. See here: Programmatically open Maps app in iOS 6

like image 34
Foti Dim Avatar answered Mar 07 '26 02:03

Foti Dim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!