简体   繁体   English

iPhone GPS - 未收到有效的位置更新

[英]iPhone GPS - Not receiving valid location updates

I have been working on a vehicle tracking app, which relies on core location services. 我一直在研究车辆跟踪应用程序,它依赖于核心位置服务。 Application is in test phase, last Friday it suddenly stopped working, there was no location updates at all (as if the GPS is not working), even when I was on my car and moving at speed of 30mph or higher. 应用程序处于测试阶段,上周五它突然停止工作,根本没有位置更新(好像GPS不工作),即使我在我的车上并以30mph或更高的速度移动。 For the whole day app didn't work at all. 整整一天,app根本不起作用。

I checked out my logs, there was not a single location update for the whole time. 我检查了我的日志,一直没有一个位置更新。 However, at that time Maps app was working perfectly fine, which makes me believe that there was no issues with iOS/GPS-Module/Signal. 然而,当时地图应用程序工作得很好,这使我相信iOS / GPS模块/信号没有问题。 On Saturday morning (the very next day) same app again started working without any changes in code or settings or re-install. 在星期六早上(第二天),相同的应用程序再次开始工作,无需更改代码或设置或重新安装。

I have been working on this app for last two month and this is the 3rd time that I faced this issue, I'm unable to track the root cause since without any kind of changes the same build starts working again. 我已经在这个应用程序工作了两个月,这是我第三次遇到这个问题,我无法跟踪根本原因,因为没有任何类型的更改,相同的构建开始再次工作。 I had this issue on two devices iPhone 3gs (ios 4.3) and iPhone 4 (ios 5.1). 我在两个设备iPhone 3gs(ios 4.3)和iPhone 4(ios 5.1)上遇到了这个问题。

So, is there anyone else who experienced some similar issue, or any tip on what could be the root cause or any hint to track such issues... 那么,是否有其他人遇到过类似的问题,或者有什么可能是根本原因的提示或任何提示来跟踪这些问题...

...UPDATE... Some updates: The statement above in the question that "I recieve not a single update" turns to be wrong, as I do receive very few location updates with worst location accuracy like +/-200m (with speed=-1 and course=-1). ...更新......一些更新:上面的问题“我收到的不是单一更新”的说法变成了错误,因为我收到的位置更新很少,位置精度最差,如+/- 200m(速度快) = -1且course = -1)。 But in my app I require at least +/-50m accuracy. 但在我的应用程序中,我需要至少+/- 50米的精度。 I had code to discard location updates with poor accuracy which caused me to think that no updates at all. 我有代码丢弃位置更新,准确性很差,导致我认为根本没有更新。

Thanks. 谢谢。

Did the app somehow lose permission from the OS to use the GPS hardware? 应用程序是否以某种方式失去了操作系统使用GPS硬件的许可? Are you checking to see if location services are enabled by checking +[CLLocationManager authorizationStatus] ? 您是否通过检查+[CLLocationManager authorizationStatus]来检查是否启用了位置服务? I know that if you delete and re-build an app to a device, you have to re-approve location access. 我知道如果您删除并重新构建应用到设备,则必须重新批准位置访问权限。 Maybe you accidentally denied it that one time? 也许你不小心一次否认它?

If you are using the "significant-change location service", it might be interesting to verify that the locations where you did not get any updates had telephone signal. 如果您正在使用“重大变更位置服务”,那么验证您未获得任何更新的位置是否有电话信号可能会很有趣。 I believe the service is using cell change and not GPS to trigger the event. 我相信该服务正在使用小区更改,而不是GPS来触发事件。

Hey you can set location accuracy with 嘿,你可以设置位置准确性

self.locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
self.locationManager.distanceFilter = 10.0f;
self.locationManager.headingFilter = 0.5;

Make sure you are forcing the update of location by updating the location manager 确保通过更新位置管理器强制更新位置

[_locationManager startUpdatingLocation];

You are prob using the didUpdateUserLocation method to get your location updates if thats not the case then use that method to get location coordinates when location is updated. 您很可能使用didUpdateUserLocation方法获取位置更新(如果不是这种情况),那么在更新位置时使用该方法获取位置坐标。

Make sure that your app does not lock and go into idle mode this will stop location updates.You can stop this by using the following 确保您的应用程序没有锁定并进入空闲模式,这将停止位置更新。您可以通过使用以下内容来停止此操作

[[UIApplication sharedApplication] setIdleTimerDisabled:YES];

Hope this help with some of your minor problems. 希望这有助于解决您的一些小问题。

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

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