gpt4 book ai didi

iphone - iOS 4.0/4.2 如何获取当前位置的经纬度?

转载 作者:太空狗 更新时间:2023-10-30 03:46:40 26 4
gpt4 key购买 nike

我在获取当前位置时遇到问题 iOS 4.0 中的经度和纬度也在 iOS 4.2 中尝试过 实际上我想在我的应用程序上绘制从当前位置到特定位置的路线,我在我的应用程序中尝试了很多方法但我不能得到结果

请回复任何知道这件事的人。

谢谢!! :)

最佳答案

CLLocationManager *lm = [[CLLocationManager alloc] init];
lm.delegate = self;
lm.desiredAccuracy = kCLLocationAccuracyBest;
lm.distanceFilter = kCLDistanceFilterNone;
[lm startUpdatingLocation];

CLLocation *location = [lm location];

CLLocationCoordinate2D coord;
coord.longitude = location.coordinate.longitude;
coord.latitude = location.coordinate.latitude;
// or a one shot fill
coord = [location coordinate];

关于iphone - iOS 4.0/4.2 如何获取当前位置的经纬度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7228376/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com