iPhone GPS Accuracy - Reading Changes eventhough Device is stationary

自闭症网瘾萝莉.ら 提交于 2019-12-06 15:54:03

The GPS on the iPhone works in away to preserve battery. The first set of coordinates will be the last know coordinates of the phone. And depending on the accuracy you desire it will try and get a better fix, first will use triangulation on wifi or cell towers.

After a while the GPS signal come thru and gives you a more precise position and the iOS will only stop update if you tell it to or if the desired accuracy is met.

What you can do is check the accuracy of the postion received and see if it meets you criteria. There is no way to just get the most accrued fix wright away, it's just going to take some time.

There is no way to improve the precision of your GPS within your app, but you can improve the accuracy of the results.

First of all, try playing with the distanceFilter of your CLLocationManger.

/*
 *  distanceFilter
 *  
 *  Discussion:
 *      Specifies the minimum update distance in meters. Client will not be notified of movements of less 
 *      than the stated value, unless the accuracy has improved. Pass in kCLDistanceFilterNone to be 
 *      notified of all movements. By default, kCLDistanceFilterNone is used.
 */
@property(assign, nonatomic) CLLocationDistance distanceFilter;

Also your desired accuracy

/*
 *  desiredAccuracy
 *  
 *  Discussion:
 *      The desired location accuracy. The location service will try its best to achieve
 *      your desired accuracy. However, it is not guaranteed. To optimize
 *      power performance, be sure to specify an appropriate accuracy for your usage scenario (eg,
 *      use a large accuracy value when only a coarse location is needed). Use kCLLocationAccuracyBest to
 *      achieve the best possible accuracy. Use kCLLocationAccuracyBestForNavigation for navigation.
 *      By default, kCLLocationAccuracyBest is used.
 */
@property(assign, nonatomic) CLLocationAccuracy desiredAccuracy;

And last, you should be playing with the accuracy of the location updates retrieved. Discarding an invalid amount of location updates based on their accuracy is a good way to get rid of those not-so-valid locations. But also be aware that it will take some time to get a real nice gps accuracy signal.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!