Core Location Manager 不要求授权

Core Location Manager does not ask for authorization

在一个简单的项目中,我实例化了一个核心位置管理器:

- (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];

}

我在 info.plist 中也有相应的键:

基于此代码的日志输出是:

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

但我没有收到授权请求...

没有错误,也没有位置更新(如果我实现委托回调)

愚蠢的错误,在错误的 plist 文件中添加了密钥(测试文件而不是应用程序文件)