views:

171

answers:

1

Hi to all when i run my application its get my location(Lat,logi) both new and old location.But i want to set oldlocation as new location when my application run first time.Because i want to calculate distance travel. If i run my application it takes oldlocation where last location it get (saw distance travel 1 Km when i start application first time)

Hope u Understand Thanks

A: 

You can try to make some flag to indicate the first launching of your app. And then store this flag in NSUserDefaults. For example, if you cannot find your flag after launch, you show alert like "would you like to use your current location as start location?" if user choose YES, so you will update location and store it in the userDefaults. This is a persistent storage. Oh, perhaps, it even will be better to store not flag, but your start location coordinates.

Morion
Thanks.One more question.how to calculate current speed.i study there is speed variable but it gives me only 0 or 1 value.so what is meaning of speed in CLLocationManager.