开发者

Which gives a more accurate location?

Which of these two methods is the more accurate one 开发者_高级运维in determining user location?

// First
[locationManager startUpdatingLocation]

// Second
[locationManager startMonitoringSignificantLocationChanges]


According to the Apple CoreLocation documentation, startUpdatingLocation is more accurate. From the documentation:

You start standard location services by calling the startUpdatingLocation method. This service is most appropriate for applications that need more fine-grained control over the delivery of location events. Specifically, it takes into account the values in the desiredAccuracy and distanceFilter property to determine when to deliver new events. This is most appropriate for navigation applications or any application where high-precision location data or a regular stream of updates is required.

Contrast this with startMonitoringSignificantLocationChanges, which, according to the documentation, is more coarse and less accurate:

For applications that do not need a regular stream of location events, you should consider using the startMonitoringSignificantLocationChanges method to start the delivery of events instead. This method is more appropriate for the majority of applications that just need an initial user location fix and need updates only when the user moves a significant distance. This interface delivers new events only when it detects changes to the device’s associated cell towers, resulting in less frequent updates and significantly better power usage.

You can control the accuracy of the location updates by using the desiredAccuracy property of the CLLocationManager class.


The first will give you updates in the desiredAccuracy set on the CLLocationManager class. Also note that the distanceFilter is also important.

The significant location changes only gets fired if you move a "significant" distance, meaning very few updates.

Find the documentation here: http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜