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

Azh*_*har 7 iphone objective-c cllocationmanager ios ios-simulator

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

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

而不是执行CLHeading代码

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

当我在这两个代码上放置断点时,它从不接触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;
}
Run Code Online (Sandbox Code Playgroud)

问题是我不知道这是由于模拟器还是代码有问题?

请帮忙.

Pra*_*n S 15

CLLocationManager需要额外的硬件,因此不会在模拟器上工作.但是,您可以使用此其他SO问题中描述的方法对其进行测试.

文档:

某些位置服务需要在给定设备上存在特定硬件.例如,标题信息仅适用于包含硬件指南针的设备.此类定义了几种可用于确定当前可用服务的方法.