longitude and latitude for current location returned from CLLocationManager in UK region is not corr
- by bond
Hi
I am getting latitude and longitude of current location from CLLocationManager delegate method. It works fine for some region but its giving problem in UK region.
When it is used in UK region, the current location longitude and latitude returned from CLLocationManager is not proper.
Thanks
heres a part of the logic i am using.
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.locationManager = [[CLLocationManager alloc] init];
if(self.locationManager.locationServicesEnabled)
{
self.locationManager.delegate = self;
self.locationManager.distanceFilter = kCLDistanceFilterNone;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
}
}
-(void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
NSLog(@"Updating");
//if the time interval returned from core location is more than 15 seconds //we ignore it because it might be from an old session
if ( abs([newLocation.timestamp timeIntervalSinceDate: [NSDate date]]) < 15)
{
self.latitude = newLocation.coordinate.latitude;
self.longitude = newLocation.coordinate.longitude;
NSLog(@"longitude=%f-- latitude=%f--",self.longitude,self.latitude);
[self.locationManager stopUpdatingLocation];
[self removeActivityIndicator];
[[self locationSaved] setHidden:NO];
[[self viewLocationInMap] setEnabled:YES];
}}