简体   繁体   中英

CLLocationManager delegate not called

I am using iBeacons, but am running into a small problem.

On first use the user needs to give permission, we then following is called:

_locationManager = [[CLLocationManager alloc] init];
_locationManager.delegate = self;
[_locationManager requestAlwaysAuthorization];

However, I expected the following delegate method to be called:

- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
    NSLog(@"Auth status changed: %i", status);
    if(status > 3){
        // Check if we have to start monitoring beacons
        NSLog(@"Do we need to initialise after auth given?");
        //[self initialiseLocations];
    }
}

I am running iOS 8.0.2, so not sure if this is a bug

This answer might help... it solved it for me at least. Also this website was a good walkthrough for this issue as well.

It looks like you are calling the requestAlwaysAuthorization correctly, but do you call startUpdatingLocation anywhere? Also, double check that in your Info.plist you have the appropriate key and string value added ( NSLocationAlwaysUsageDescription since you're using requestAlwaysAuthorization ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM