iPhone模拟器上的CLLocationManager因kCLErrorDomain Code = 0而失败 [英] CLLocationManager on iPhone Simulator fails with kCLErrorDomain Code=0

查看:106
本文介绍了iPhone模拟器上的CLLocationManager因kCLErrorDomain Code = 0而失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CLLocationManager 应该伪造Cupertino(不是吗?)但它没有,它失败了 kCLErrorDomain Code = 0 而不是。 LocationManager的委托收到消息 didFailWithError 。实现此方法以记录错误,控制台输出以下内容:

CLLocationManager on iPhone Simulator is supposed to fake Cupertino (isn't it?) but it does NOT, it fails with kCLErrorDomain Code=0 instead. LocationManager's delegate receives the message didFailWithError. This method is implemented to log the error and the console outputs the following:

Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)"

我正在做一个真实的项目遇到这个问题,但讨论我的代码是没有意义的,因为我从开发中心下载了Locations示例代码(iOS 4更新为2010-06-22)并且问题仍然存在。

I was working on a real project when I ran into this problem but it is pointless to discuss my code because I downloaded "Locations" sample code (updated 2010-06-22 for iOS 4) from the dev center and the problem persisted.

该应用程序在收到第一个位置更新时启用添加按钮,以便用户可以跟踪他们的位置,但它什么都不做。

The app is suposed to enable an "add" button when it receives the first location update so users can track their locations but it does nothing.

I在 didFailWithError 的实现中添加了一条(普通的)行来记录错误(如果有的话)。我得到了上面描述的错误。

I added one (trivial) line to the implementation of didFailWithError to log the errors, if any. I get the error described above.

使用Xcode 3.2.2和目标3.1.3,我可以在运行旧版本的旧版本时获得固定位置(Cupertino)地点项目。

With Xcode 3.2.2 and targeting 3.1.3, I could get a fixed location (Cupertino) when running an older version of the "Locations" project.

有人可以帮忙吗?

谢谢。

推荐答案

CLLocationManager iOS模拟器5.0 上再次按预期工作。

CLLocationManager started to work as expected again on the iOS Simulator 5.0.

根据我的经验,它曾经在 iOS模拟器4.0上与 kCLErrorDomain Code = 0 一致失败通过 4.3 。如其他答案所示,打开机场并连接到Wi-Fi对我的情况没有帮助。但是,我要感谢大家的回答。我只是通过测试设备上的所有核心位置代码解决了这个问题。

In my experience, it used to fail consistently with kCLErrorDomain Code=0 on the iOS Simulator 4.0 through 4.3. Turning the airport on and connecting to a Wi-Fi, as suggested by the other answers, did not help in my case. However, I would like to thank everybody for their answers. I simply worked around this issue by testing all the Core Location code on a device.

最近我升级到XCode 4.2(来自XCode 3.2.6)和iOS模拟器5.0它附带了它,因此,我注意到 CLLocationManager 开始按预期再次工作。在XCode 4.2中选择较旧的模拟器时,它会一直失败;它指的是模拟器的责任。

Recently I upgraded to XCode 4.2 (from XCode 3.2.6) and the iOS Simulator 5.0 that comes with it, and as a result of that, I noticed that the CLLocationManager started to work as expected again. When selecting an older simulator in XCode 4.2, it keeps failing; which points to the simulator as the one to blame.

这篇关于iPhone模拟器上的CLLocationManager因kCLErrorDomain Code = 0而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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