【发布时间】:2020-02-06 08:43:01
【问题描述】:
如何在 YandexMapkit 中找到用户坐标?
我使用 Location 类并开处方
private Location location;
location.getPosition();
但它是空的。
【问题讨论】:
标签: android yandex yandex-mapkit
如何在 YandexMapkit 中找到用户坐标?
我使用 Location 类并开处方
private Location location;
location.getPosition();
但它是空的。
【问题讨论】:
标签: android yandex yandex-mapkit
您应该查看存储库: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 “隐私 - 使用时的位置使用说明”。
【讨论】: