gpt4 book ai didi

iphone - iphone模拟器是否能够显示航向和纬度,经度?

转载 作者:可可西里 更新时间:2023-11-01 03:25:45 28 4
gpt4 key购买 nike

我正在使用 iphone 模拟器 4.2 并尝试显示或 NSLog 标题和其他位置服务属性,例如纬度、经度、高度、水平精度、垂直精度、速度。但它没有显示正确的参数和标题的 Incase 它实际上没有触发事件。作为其执行CLLocation代码

- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
[self.delegate locationUpdate:newLocation];
}

并且不执行CLHeading代码

- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading
{
[self.delegate headingUpdate:newHeading];
}

当我在这两个代码上放置断点时,它永远不会触及 CLHeading 代码。我正在更新 init 中的位置和航向。

- (id) init{
if (self!=nil) {
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
self.locationManager.distanceFilter = kCLDistanceFilterNone;
[self.locationManager startUpdatingLocation];
[self.locationManager startUpdatingHeading];
}
return self;
}

问题是不知道是模拟器问题还是代码有问题?

请帮忙。

最佳答案

CLLocationManager 需要额外的硬件,因此无法在模拟器上运行。但是,您可以使用 this other SO question 中描述的方法进行测试.

来自documentation :

Some location services require the presence of specific hardware on the given device. For example, heading information is available only for devices that contain a hardware compass. This class defines several methods that you can use to determine which services are currently available.

关于iphone - iphone模拟器是否能够显示航向和纬度,经度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6922507/

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