Question

My app uses Core Location. The only place I access the Location manager after initialization is in the delegate where I grab the current location:

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray*)locations
{
}

When the app starts up, the delegate gets called through

- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status

with kCLAuthorizationStatusAuthorized. All fine.

Then this gets called:

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
    NSLog(@"%@", error) ;
    return ;
}

giving the error:

Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)

After that, everything behaves as I would expect. Locations come in with no problem. This error does not seem to indicate a real problem.

Does anyone know if 1) there is some way to avoid this error at startup and 2) is there some way for me to differentiate between this apparently meaningless error and one that I should pay attention to?

Was it helpful?

Solution

Your error come only when you are in the simulator, right :) ?

If you try the app on your iPhone, it will not show the error.

If you want to solve the error in the simulator, each time that you launch the app, choose a location in the menu of the simulator app ~> Debug ~> Location.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top