Hi there guys
I need help with handling location co-ordinates with xcode; to be precise, the conversions.
i have CLLocation object, which has lat and long received using the phone’s geo location, works fine. But i am having issues handling the conversions.
i am storing the lat and long values in the userdefaults using
[defaults setObject:[NSString stringWithFormat:@"%.9lf",location.coordinate.latitude] forKey:@"lastKnownLat"];
but the decimal values of the location is ofcourse not precise, its could be 3.123456789 or 3.12345 – in the later case, the value is converted to 3.123459999 which i presume gives wrong positioning on the map.
How can i avoid this?
What could be the best way to store lat/long values and show them on the map?
in the mapkit, will it maek a lot of difference between 3.12345 and 3.12345999?
Thanks
NSUserDefaultshas methods specifically for saving floating-point values, and you can use setDouble:forKey: to preserve as much precision as possible.