Search code examples
iosobjective-cios9core-location

Core Location Manager does not ask for authorization


In a simple project, I instantiate a Core Location Manager:

- (void)viewDidLoad {
[super viewDidLoad];
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.desiredAccuracy =
kCLDistanceFilterNone;
self.locationManager.delegate = self;
if([CLLocationManager locationServicesEnabled]) {
    // Location Services Are Enabled
    switch([CLLocationManager authorizationStatus]) {
        case kCLAuthorizationStatusNotDetermined:
            NSLog(@"1");
            [self.locationManager requestWhenInUseAuthorization];
            NSLog(@"requested auth");
            break;
        case kCLAuthorizationStatusRestricted:
            NSLog(@"2");
            break;
        case kCLAuthorizationStatusDenied:
            NSLog(@"3");
            break;
        case kCLAuthorizationStatusAuthorized:
            NSLog(@"4");
            break;
    }
} else {
    // Location Services Disabled
}
[self.locationManager startUpdatingLocation];

}

I also have the appropriate keys in info.plist:

enter image description here

the log output, based on this code, is:

[233:5927] 1
[233:5927] requested auth

but i get no authorization request...

no errors and no location updates (if I implement the delegate callbacks)


Solution

  • Stupid mistake, added the keys in the wrong plist file (the testing one instead of the app one )