Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Core Location not working in iOS 8

I'm trying to use significant change location monitoring in iOS 8, but the didUpdateLocations method is never called. Here is the code for setting up the location manager:

- (void)viewDidLoad
{
    [super viewDidLoad];
    CLLocationManager *locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    [locationManager requestWhenInUseAuthorization];
    [locationManager startMonitoringSignificantLocationChanges];
}

Despite calling requestWhenInUseAuthorization, nothing pops up to ask the user to authorize it. I have set NSLocationWhenInUseUsageDescription, and it still does not work. didChangeAuthorizationStatus and didFailWithError are also never called. EDIT: I was able to get it to ask the user to allow location services, but even if you click allow it never shows the location.

like image 447
charleyh Avatar asked Jul 21 '14 21:07

charleyh


1 Answers

There is currently a bug in iOS8 beta5 which always deactivate geolocation service for your app (at least for mine).

Go in settings > Privacy > Location services > Your app > Always.

But I don't know why, but even if you set it to Always this setting will auto-deactivate, so please be patient and often return in the settings to configure again your app location.

like image 77
Martin Avatar answered Oct 06 '22 22:10

Martin