简体   繁体   English

CLLocationmanager未更新当前位置

[英]CLLocationmanager Not Updated Current Location

I am new in IOS Development.I use GeoCoding and CLLocationManager in IOS8 for getting user current Location. 我是IOS开发的新手,我在IOS8中使用GeoCoding和CLLocationManager获取用户当前位置。 But issue is that when I set location Xcode>Product>Scheme>Edit Scheme>Chek Allow location simulation and setting any location like Mumbai, India, it will be show on my view controller.But I want to access my current location where am I instead of setting location through scheme. 但是问题是当我设置位置Xcode>Product>Scheme>Edit Scheme>Chek Allow location simulation并设置任何位置(如印度孟买)时,它将显示在我的视图控制器上。但是我想访问我当前所在的位置而不是通过方案设置位置。 when i set none location through scheme CLLocation manager not working and give me failed to get your location 当我通过方案CLLocation管理器未设置任何位置时,位置管理器无法正常工作,并且无法获取您的位置

Error Domain=kCLErrorDomain Code=0 "The operation couldn't be completed. (kCLErrorDomain error 0.)" 错误域= kCLErrorDomain代码= 0“操作无法完成。(kCLErrorDomain错误0。)

please help whats issue?? 请帮助什么问题? Thanx in advance 提前感谢

I don't think the simulator support to locate the current location. 我认为模拟器不支持定位当前位置。 You may want a real iOS device. 您可能需要一个真正的iOS设备。

If you really want to simulate your location.You may use google map or something else to know your cordinate. 如果您真的想模拟自己的位置。可以使用Google地图或其他方式来了解您的坐标。 then make it into your GPX file,you can load your custom GPX file. 然后将其放入您的GPX文件中,即可加载自定义GPX文件。

This happens mainly due two reason. 发生这种情况主要是由于两个原因。 Any one of this will help you. 这其中的任何一项都会对您有所帮助。 Not only in the case of location, some time when we use simulator in a speedy manner at that time also occur, for that case the second option generally helps. 不仅在位置上,有时还会出现我们快速使用模拟器的时间,在这种情况下,第二种选择通常会有所帮助。

  1. This error also occurs if you have Scheme/Edit Scheme/Options/Allow Location Simulation checked but don't have a default location set. 如果已选中方案/编辑方案/选项/允许位置模拟,但未设置默认位置,也会发生此错误。

在此处输入图片说明

Select any one of the default loation. 选择默认位置之一。

  1. The second reason may be due to simulator problem. 第二个原因可能是由于模拟器问题。 Many time this solves this. 很多时候这解决了这个问题。

Under the simulator:click reset content and setting. 在模拟器下:单击重置内容和设置。 Turn off the simulator. 关闭模拟器。 run your app. 运行您的应用。

在此处输入图片说明

Hope this will help you 希望这个能对您有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM