Ios – How to Open Google Map Navigation Url with Direction and Voice in iOS


i am newbie in iOS I want to make an app that contain map kit navigation.i want to open navigation url of google map if user device have Google map application. if it is not contain then i want to open Apple map Here i write a code for like as

if ([[UIApplication sharedApplication] canOpenURL:
     [NSURL URLWithString:@"comgooglemaps://"]])
    NSString *urlString=[NSString stringWithFormat:@"comgooglemaps://?center=%f,%f&zoom=14&views=traffic",self.latitude,self.longitude];
    [[UIApplication sharedApplication] openURL:
     [NSURL URLWithString:urlString]];
    NSString *string = [NSString stringWithFormat:@",%f",self.latitude,self.longitude];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];

But here i want to open google map or apple map with turn by turn direction between User current location and Selected Location how it is Possible Please Give me Solution For this.

Best Solution

For Google Map You would need to do something like this:-

Use this scheme to request and display directions between two locations. You can also specify the transportation mode.

Parameters saddr: Sets the starting point for directions searches. This can be a latitude,longitude or a query formatted address. If it is a query string that returns more than one result, the first result will be selected. If the value is left blank, then the user’s current location will be used. daddr: Sets the end point for directions searches. Has the same format and behavior as saddr. directionsmode: Method of transportation. Can be set to: driving, transit, bicycling or walking.

An example URL is below to display transit directions between Google NYC and JFK Airport:


enter image description here

Some additional example are below:



Refer to:

For Apple Map do like this:- The following examples show the strings you would use to provide driving directions between San Francisco and Cupertino:




This works for me, only issue i can see with your query is accurate lat long values(Those looks to be a degree latitude longitude value but passed as a decimal latitude longitude value.

Example Route from Downey to Los Angles NSString *string = [NSString stringWithFormat:@" daddr=%1.6f,%1.6f&saddr=%1.6f,%1.6f",34.0522300,-118.2436800,33.9400100,-118.1325700];

enter image description here

But for some of the directions it does not work and shows Directions not available

enter image description here

Related Question