我收到此错误:更新位置时出错操作无法完成。 (kCLErrorDomain误差为0)
Error while updating location The operation couldn’t be completed. (kCLErrorDomain error 0.)
我的问题是,这个错误显示几乎每次我运行模拟器,它不断显示我的错误整体时间模拟器运行(每当我给视图控制器一个地图它显示我这个错误)。最奇怪的是,有时这个错误是零,一切都很好。在一个实际的设备上它工作正常,但是当我想尝试一些位置(在模拟器上)时,我必须重新启动模拟器大约7次,直到它工作。
这是Info.plist的:
我的位置是自定义的:
这是我的代码:
func locationManager(manager: CLLocationManager, didFailWithError error: NSError) {
print("Error while updating location " + error.localizedDescription)
let alertController = UIAlertController(title: "Sorry!", message: "We were unable to find your location", preferredStyle: UIAlertControllerStyle.Alert)
let defaultAction = UIAlertAction(title: "OK", style: .Default, handler: nil)
alertController.addAction(defaultAction)
presentViewController(alertController, animated: true, completion: nil)
print("Error...")
}
我的问题是,为什么有时只有作品? 谢谢:)
您可以点击此链接。 http://stackoverflow.com/questions/6032976/didfailwitherror-error-domain-kclerrordomain-code-0-the-operation-couldn-t-be –
我已经看到了这个问题,我找不到解决方案:/ –
然后选择模拟器菜单>调试>位置>设置自定义或选择任何0r检查互联网连接 – Sandy