gpt4 book ai didi

ios - CLGeocoder reverseGeocodeLocation 不适用于模拟位置

转载 作者:行者123 更新时间:2023-11-29 00:04:24 29 4
gpt4 key购买 nike

我从 Xcode 的方案中启用位置模拟检查 Allow Location Simulation 并从下拉列表中选择示例位置 - New York, NY, USA

这是我从位置获取地点信息的代码。currentLocation 是从 CLLocationManager 获取的,我看到该值恰好是 NewYork 位置。

- (void) fetchPlacemarks: (CLLocation*) currentLocation
{
// Reverse-geolocate the current location
CLGeocoder* geoCoder = [[CLGeocoder alloc] init];
[geoCoder reverseGeocodeLocation: currentLocation
completionHandler: ^(NSArray<CLPlacemark*>* placemarks,
NSError* error)
{
// getting error "The operation couldn’t be completed. (kCLErrorDomain error 8.)"
}
}

我已经通过模拟器和具有真实位置(不是模拟)的设备进行了测试,但它们的效果非常好。

只是它在模拟位置的设备上不起作用。这里有什么问题吗?

最佳答案

在真实设备上,只能通过调试器进行模拟,看这里:

Simulating a location on Real iOS Device

关于ios - CLGeocoder reverseGeocodeLocation 不适用于模拟位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48543181/

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