0

I am using both the simulator and my device to test this, but no matter what I do, didUpdateToLocation is never called. I have tried changing my location in the sim, turning off and then on again my location services on my phone to force the phone to search for a new location... nothing. In my viewDidLoad(), I have started the CLLocationManager as so:

CLLocationManager *manager = [[CLLocationManager alloc] init];

if (![CLLocationManager locationServicesEnabled])    
{
    UIAlertView *servicesDisabledAlert = [[UIAlertView alloc] initWithTitle:@"Location Services Disabled" message:@"You currently have all location services for this device disabled. If you proceed, you will be asked to confirm whether location services should be reenabled." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [servicesDisabledAlert show];

} else {
    manager.desiredAccuracy = kCLLocationAccuracyBest;

    manager.delegate = self;

    [manager startUpdatingLocation];


}

and in the update location method I have this:

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{

NSLog(@"NEW LOCATION! Accuracy:[%f]",newLocation.horizontalAccuracy);

}

Does anyone have any ideas why this isn't being called?

Alex
  • 3,031
  • 6
  • 34
  • 56

2 Answers2

2

Did you add location delegate in your header file ?

AAV
  • 3,785
  • 8
  • 32
  • 59
1

I don't know if this is the issue but try

manager.desiredAccuracy = kCLLocationAccuracyKilometer;      

or

manager.desiredAccuracy = kCLLocationAccuracyTenMeters; 

instead of

manager.desiredAccuracy = kCLLocationAccuracyBest;

and see if that makes any change.

Setting desiredAccuracy to best timed out most of the times when I test my location dependent apps on my iPhone. Especially when you are indoors.

Semere Taézaz Sium
  • 4,036
  • 3
  • 21
  • 26