为啥 CLLocationManager 在模拟器中的 iphone SDK 4 beta 上返回空位置?

Posted

技术标签:

【中文标题】为啥 CLLocationManager 在模拟器中的 iphone SDK 4 beta 上返回空位置?【英文标题】:Why does CLLocationManager returns null locations on the iphone SDK 4 beta in the Simulator?为什么 CLLocationManager 在模拟器中的 iphone SDK 4 beta 上返回空位置? 【发布时间】:2010-06-14 20:48:10 【问题描述】:

我有这段代码:

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation

    NSLog(@"Manager did update location!!");
    self.currentLocation = newLocation.description;

我在符合CLLocationManagerDelegate 的类中有这段代码。我早些时候在 sdk 3.0 中测试过并且效果很好(在模拟器和设备上)。我正在模拟器中的 SDK 4 上测试这个类,但它提供了 null 作为新位置。我什至无法获得第一次通话的 NSLog。我检查了我使用位置框架的其他应用程序,但它也不起作用。

我还实现了locationManager:didFailWithError: 消息,它从未被调用过。

任何人都可以确认模拟器不能执行任何 CLLocationManager 功能吗? (将错误报告为已知问题的链接将很棒)。有没有办法解决这个问题?

提前致谢。

-更新:我在新的 SDK4 GM 版本上对此进行了测试,但仍然无法正常工作。

【问题讨论】:

【参考方案1】:

您不能在 Apple 开发者网站之外讨论 SDK 4,直到它完成测试版并向公众发布。

【讨论】:

以上是关于为啥 CLLocationManager 在模拟器中的 iphone SDK 4 beta 上返回空位置?的主要内容,如果未能解决你的问题,请参考以下文章

为啥'CLLocationManager.locationServicesEnabled()'默认为真?

为啥飞行模式开启时 CLLocationManager 不会失败?

CLLocationManager startMonitoringVisits在模拟器中不起作用

Xcode 6 为啥 CLLocationManager 没有返回纬度和经度

用于测试的模拟 CLLocationManager (swift)

iPhone 模拟器上的 CLLocationManager 因 kCLErrorDomain Code=0 而失败