Can't get current location from my code:
(IBAction)getdetails:(id)sender {
manager.delegate = self;
manager.desiredAccuracy = kCLLocationAccuracyBest;
[manager startUpdatingLocation];
}
#pragma mark - CLLocationManagerDelegate
(void)locationmanager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
NSLog(@"didFailWithError: %@", error);
UIAlertView *errorAlert = [[UIAlertView alloc]
initWithTitle:@"Error" message:@"Failed to Get Your Location" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[errorAlert show];
}
(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
NSLog(@"didUpdateToLocation: %@", newLocation);
CLLocation *currentLocation = newLocation;
if (currentLocation != nil) {
_latitudelabel.text = [NSString stringWithFormat:@"%.8f", currentLocation.coordinate.longitude];
_latitudelabel.text = [NSString stringWithFormat:@"%.8f", currentLocation.coordinate.latitude];
}