1

At the moment I have an application that uses the users current geographic location.

Whenever I run the application on my device or simulator, the app opens and immediately turns my Location Services from "Authorized" to "Not Determined". For some reason this is only happening to me and none of my other developers.

I'm not sure if this is a problem with Xcode, which I updated to 6.01 last night, or something in my code.

I've tried resetting the Location Services for the application, but immediately when I go back to the application it changes it back to "Not Determined".

Any idea what is causing this issues? Has anyone run into a similar problem?

Below is a snippet of code from my locationManager.

- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status{
NSLog(@"did change status");

if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined) {
    NSLog(@"not determined");

} else if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized) {
    NSLog(@"Authorized");
    [[NSNotificationCenter defaultCenter] postNotificationName:@"Location Services Authorized" object:self];

} else if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusRestricted){
    NSLog(@"restricted");
    [[NSNotificationCenter defaultCenter] postNotificationName:@"Location Services Restricted" object:self];

} else if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied) {
    NSLog(@"denied");
    [[NSNotificationCenter defaultCenter] postNotificationName:@"Location Services Denied" object:self];

} else {
    NSLog(@"can not");
Adam Cooper
  • 867
  • 1
  • 6
  • 23

3 Answers3

1

I don't see in your code where you are calling requestWhenInUseAuthorization. This is required in iOS8 to ask the user for authorization before location services will work.

Just call it on the location manager every time you start location service to make sure you have permission (it does nothing if you already have permission or it has already been denied).

progrmr
  • 75,956
  • 16
  • 112
  • 147
0

May be application have not access to location service, it should be off in setting screen, could you check that? Go on Settings > Privacy > Location Services > "Your Application" > On

virus
  • 1,203
  • 13
  • 21
0

I solved the problem!

It turns out Apple made a couple changes to their Core Location manager.

You can read more about it here:

http://nevan.net/2014/09/core-location-manager-changes-in-ios-8/

Thanks for the help.

Adam Cooper
  • 867
  • 1
  • 6
  • 23