2
   self.locationManager = [[[CLLocationManager alloc] init]autorelease];
   self.locationManager.pausesLocationUpdatesAutomatically=NO;
   [self.locationManager setDelegate:self];
   if([[[UIDevice currentDevice ]systemVersion] floatValue]>=8.0)
      {
        if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
            [self.locationManager requestWhenInUseAuthorization];
        }
    }
   [self.locationManager startUpdatingLocation];

The code never calls didUpdate locations method instead did fail with error called immediately. Error Description: The operation couldn’t be completed. (kCLErrorDomain error 0.) But some times didUpdate locations getting called (1 out of 20 times), Tried resetting Network and locations settings but still not working.

Thank you

siva krishna
  • 1,149
  • 2
  • 15
  • 23

2 Answers2

1

Have you tried to take a look at my answer there ?

In short :

  • Product -> Scheme -> Edit Scheme -> Options -> Allow Location Simulation must be checked and try providing a default location, don't leave it set to "none"
Community
  • 1
  • 1
H4Hugo
  • 2,570
  • 3
  • 16
  • 32
0

This helped me out:

enter image description here

Simulator -> Features -> Location -> Custom Location...

Then set a preferred Custom Location with latitude and longitude. Whatever you do, you don't want to leave None, checked.

Waheed
  • 41
  • 2
  • 8