4

是否有用于启动带有方向的 Yandex 地图应用程序的 URL 方案?

我可以用几行代码启动 Yandex Maps 应用程序(如果已安装),但我没有找到有关应用程序处理的 URLSchemes 的文档:

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

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

8 回答 8

7

还有另一个 Yandex 制图应用程序 Yandex.Navigator,它支持方向。如果您可以接受这样的解决方案,那么您可以使用这样的方案:

yandexnavi://build_route_on_map?lat_from=55.751802&lon_from=37.586684&lat_to=55.758192&lon_to=37.642817

访问这里了解详情。

于 2014-05-15T23:35:09.537 回答
6

实际上,截至今天,这是一种误导,有一个 URL 方案来获取方向。

yandexmaps://build_route_on_map/?params

例子:

[[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 和 lon_from 是可选的,没有提供时使用当前位置。不要忘记检查是否安装了 yandex.maps 应用程序

NSURL *callUrl = [NSURL URLWithString:@"yandexmaps://"];

if ([[UIApplication sharedApplication] canOpenURL:callUrl])

{
    //Yandex.Maps app is installed

}

文件(俄语)

于 2015-03-03T09:22:46.030 回答
3

斯威夫特 5

如果需要打开 Yandex Navi 可以这样使用;

1-您应该像这样将'yandexnavi'添加到info.plist;

 <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>yandexnavi</string>
    </array>

2-您应该检查应用程序是否已安装;

UIApplication.shared.canOpenURL(URL(string: "yandexnavi://")!)

3- 你应该用 lat & long 打开 Yandex Navi;

let url = URL(string: "yandexnavi://build_route_on_map?lat_to=" + "\(lat)" + "&lon_to=" + "\(long)")

UIApplication.shared.open(url, options: [:], completionHandler: nil)
于 2019-05-31T08:07:12.113 回答
3

这不是 iOS 特定的,但我希望它可以帮助寻找 Yandex 路线 URL 的人,因为我花了很长时间才找到它。所以对于一个网络应用程序,我使用了这个

https://yandex.ru/maps?rtext=FROM~TO&rtt=auto

其中 FROM 或 TO 以及rtt参数都是可选的。所以你可以使用

https://yandex.ru/maps?rtext=~Berlin

引导从任何地方到柏林的人。

将支持谷歌地图的网络应用程序移植到 Yandex 我一直在寻找谷歌地图方向链接的等效链接https://www.google.com/maps/dir/FROM/TO,最后在 SO 上找到了这个。@NKorotkov 回答的文档链接将我带到这里:https ://tech.yandex.ru/yandex-apps-launch/maps/doc/concepts/yandexmaps-ios-app-docpage/#buildroute

于 2016-09-05T10:13:57.207 回答
2

这有效:"yandexnavi://build_route_on_map?lat_to=" + latvalu + "&lon_to=" + longvalue

于 2017-12-21T14:53:09.030 回答
1

尝试:

yandexmaps://maps.yandex.ru/?

您可以添加参数,例如

yandexmaps://maps.yandex.ru/?ll=37.5959049,55.7390474&z=12 其中 ll -> 将在屏幕上可见的地理中心 z-> 是缩放值

更多信息在这里,但它是俄语:http ://clubs.ya.ru/mobilemaps/replies.xml?item_no=53530

更新: 根据网站:

不幸的是,适用于 iOS 的 Yandex 地图应用程序不支持通过 URL 方案进行导航

于 2014-03-02T15:13:03.363 回答
0
@"yandexmaps://maps.yandex.ru/?pt={0},{1}"
于 2017-10-24T19:42:08.110 回答
0

您可以从Intents and URL Schemes部分查看俄语技术文档

您将看到 yandex 地图、导航和 Metro 应用程序的所有 url 方案。

Yandex 地图

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"yandexmaps://"]]) {
   [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"yandexmaps://maps.yandex.ru/?ll=37.62,55.75&z=12"]];
} else {
// Открываем страницу приложения Яндекс.Карты в App Store.
   [[UIApplication sharedApplication] openURL:
    [NSURL URLWithString:@"https://itunes.apple.com/ru/app/yandex.maps/id313877526?mt=8"]];
}

Yandex 导航

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"yandexnavi://"]]) {
   [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"yandexnavi://"]];
} else {

// Открывает страницу приложения Яндекс.Навигатор в App Store.
   [[UIApplication sharedApplication] openURL:
    [NSURL URLWithString:@"https://itunes.apple.com/ru/app/yandex.navigator/id474500851"]];
}

Yandex地铁

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"yandexmetro://"]]) 
{
      [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"yandexmetro://?alias=moscow"]];
} 
else
{
// Открываем страницу приложения Яндекс.Метро в App Store.
   [[UIApplication sharedApplication] openURL:
    [NSURL URLWithString:@"https://itunes.apple.com/ru/app/yandex.maps/id313877526?mt=8"]];
}
于 2018-09-06T16:55:30.210 回答