【问题标题】:How to find user coordinates in Yandex Map kit?如何在 Yandex 地图套件中查找用户坐标?
【发布时间】:2020-02-06 08:43:01
【问题描述】:

如何在 YandexMapkit 中找到用户坐标?

我使用 Location 类并开处方

private Location location;
location.getPosition();

但它是空的。

【问题讨论】:

    标签: android yandex yandex-mapkit


    【解决方案1】:

    您应该查看存储库:https://github.com/yandex/mapkit-ios-demo - 有很多有用的示例。 如果我想在 iOS 应用程序中获取用户位置,我会这样做:

        let mapKit = YMKMapKit.sharedInstance()
        let userLocationLayer = mapKit.createUserLocationLayer(with: mapView.mapWindow)
        userLocationLayer.setVisibleWithOn(true)
        userLocationLayer.isHeadingEnabled = true
    

    mapView - 是 YMKMapView!从故事板。

    当然,您还应该向用户询问权限并添加到 info.plist “隐私 - 使用时的位置使用说明”。

    【讨论】:

      猜你喜欢
      • 2023-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-15
      • 2017-01-18
      • 2020-05-09
      • 1970-01-01
      相关资源
      最近更新 更多