Search code examples
iosmapsurl-schemedirectionsyandex

iOS - Launch YandexMaps with directions URLScheme


Is there an URL-Scheme for launch the Yandex Maps application with directions?

I can just launch the Yandex Maps application (if already installed) with few lines of code, but I didn't found documentation about URLSchemes handled by the app:

NSURL *url = [NSURL URLWithString:@"yandexmaps://maps.yandex.ru/"];

if([[UIApplication sharedApplication] canOpenURL:url]){
    [[UIApplication sharedApplication] openURL:url];
}

Solution

  • Actually, as of today this is misleading, there is a URL-scheme to get directions.

    yandexmaps://build_route_on_map/?params

    Example:

    [[UIApplication sharedApplication] openURL:
    [NSURL URLWithString:@"yandexmaps://build_route_on_map/?lat_from=59.967870&lon_from=30.242658&lat_to=59.898495&lon_to=30.299559"]];
    

    lat_from and lon_from are optional, current position is used when they are not provided. Don't forget to check if yandex.maps app is installed

    NSURL *callUrl = [NSURL URLWithString:@"yandexmaps://"];
    
    if ([[UIApplication sharedApplication] canOpenURL:callUrl])
    
    {
        //Yandex.Maps app is installed
    
    }
    

    Documentation (in Russian)