是iPhone模拟器能够显示标题和纬度,经度?
我正在使用iphone模拟器4.2,并尝试显示或NSLog
标题和其他位置服务的属性,如经度,纬度,高度,水平精度,VerticalAccuracy,速度。 但它没有显示正确的参数和标题,实际上并没有发射事件。 作为它的执行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
需要额外的硬件,因此不会在模拟器上工作。 但是,您可以使用在其他SO问题中描述的方法来testing。
从文档 :
一些位置服务需要在给定设备上存在特定的硬件。 例如,标题信息仅适用于包含硬件指南针的设备。 这个类定义了几个方法,可以用来确定哪些服务当前可用。
这个答案可以更新为任何使用Xcode 4.2的人。 它仍处于testing版状态,但如果您是付费开发者,则可以访问它。 另外,如果您是付费开发者,则可以从WWDC 2011获得一些很好的video,解释如何使用模拟器进行位置模拟。
WWDC 2011
查看核心位置的新增function,并在不离开主席的情况下testing您的位置感知应用程序
**注意:请再次注意,只有付费开发者才能访问这些video
它看起来像行为是默认情况下,它会触发位置,而不是标题。
我没有在实际的硬件上testing我的应用程序来确认我的…
安东尼·德萨
- 使用iOS Geofencing跟踪多个(20+)位置
- 按照用户所在的方向旋转GMSMarker
- iOS版。 CLLocationManager只在didUpdateLocations中接收位置更新一次
- iOS 11 – 添加委托之后,未收到位置更新
- 当飞行模式打开时,CLLocationManager如何获取一个位置
- 'CLLocationManager'没有可见的@interface声明select器'requestAlwaysAuthorization'
- 核心位置无法在viewDidLoad中获取数据
- 后台的StartUpdateLocations,didUpdatingToLocation只调用了10-20次
- 监视重要位置更改的iOS应用程序是否可以在设备重启时重新启动?