iPhone Simulator能够显示航向和纬度,经度吗? [英] is iphone Simulator capable of showing heading and latitude , longitude?

查看:108
本文介绍了iPhone Simulator能够显示航向和纬度,经度吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using iphone simulator 4.2 and try to display or NSLog Heading and other Location services attributes e.g. Latitude, Longitude, altitude, horizontalAccuracy, VerticalAccuracy, speed. but its not showing the correct parameters and Incase of Heading its actually not firing the event. as its execute CLLocation code

- (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。

and when I put breakpoint on these both codes it never touch CLHeading code. I am updating location and heading in 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;
}

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

The problem is that I do not know that is due to simulator or there is any problem in code?

请帮助。

推荐答案

CLLocationManager 需要其他硬件,因此无法在模拟器上工作。但是,您可以使用其他SO问题中所述的方法进行测试。

CLLocationManager needs additional hardware and hence wont work on simulator. However you can test that using the method described in this other SO question.

文档


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

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 Simulator能够显示航向和纬度,经度吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆