CLLocation DistanceFrom performance implications

141 Views Asked by At

I'm developing an iOS application where I need to track the distance walked by the user real-time and alter data accordingly.

Essentially what I'm doing is, as soon as the user makes a move, I check the distance between the original and current positions and react accordingly (using CLLocation's DistanceFrom method).

Are there performance implications of using DistanceFrom repeatedly that I should be prematurely worried about?

Edit: Forgot to mention, I'm using Xamarin.iOS (aka MonoTouch)

2

There are 2 best solutions below

0
On BEST ANSWER

I have a feeling that CLLocation's DistanceFrom method just uses the haversine method under the hood. So wont have a huge effect on performance.

I have used this before and not noticed much in the way of performance. Bit more info on the implementation.

0
On

The issue wont likely be the distance computation, but the retrieval of the geo location information in the first place.

Apple has a handy guide on things you should keep in mind to reduce battery usage:

https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html#//apple_ref/doc/uid/TP40009497-CH2-SW10