如何在YandexMapkit中找到用户坐标?
我使用Location类并指定
private Location location;
location.getPosition();但它是空的。
发布于 2020-04-05 21:18:39
你应该看看仓库:https://github.com/yandex/mapkit-ios-demo --有很多有用的示例。如果我想在iOS应用程序中获取用户位置,我会这样做:
let mapKit = YMKMapKit.sharedInstance()
let userLocationLayer = mapKit.createUserLocationLayer(with: mapView.mapWindow)
userLocationLayer.setVisibleWithOn(true)
userLocationLayer.isHeadingEnabled = truemapView - is YMKMapView!来自故事板。
当然,你也应该询问用户的权限,并在info.plist中添加“使用时的隐私-位置描述”。
https://stackoverflow.com/questions/60090813
复制相似问题