【发布时间】:2013-06-21 21:59:05
【问题描述】:
我最近开始在 iPhone 5 上测试我的应用程序,但令我震惊的是,CLLocationManager 似乎无法正常工作!虽然[CLLocationManager headingAvailable] 是YES,但我根本没有收到任何标题更新。奇怪的是,在 iPhone 4 上,经过 30 次左右的标题更新,locationManager:didUpdateToHeading: 不再被调用。这个问题是全新的。位置管理器还为verticalAccuracy 返回负数,所以我假设它的高度是无效的。以下是我创建位置管理器的方式:
CLLocationManager* locationManager = [[CLLocationManager alloc] init];
if([locationManager respondsToSelector:@selector(disallowDeferredLocationUpdates)]) {
[locationManager disallowDeferredLocationUpdates];
[locationManager setPausesLocationUpdatesAutomatically:NO];
}
locationManager.headingOrientation = CLDeviceOrientationFaceUp;
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.headingFilter = -1;
locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
[sharedSingleton setLocationManager:locationManager];
sharedSingleton 只是我的单例类,它处理一些零碎的事情,包括保持对位置管理器的引用。
如果我需要发布更多代码,请告诉我。我只是不知道是什么导致了这个奇怪的问题。谢谢!
【问题讨论】:
标签: iphone ios cllocationmanager cllocation heading