Hi Guys,
Small problem.. I'm checking for both conditions,
Location Services are globally disabled,
or Location Services were not authorised for the App.
I use this code straight after enabling Location Services in the App.
So if "errorcode" is set to 1 I can go about handling the absence of core location.
Problem is, every time I delete the App from a device, and run it for the first time,
I can deny the App's permission to use Location Services, and errorcode
is not set to 1, and the alert doesn't show, and Location Services are not working.
The second time I run the App, all is well. The alert does show,
and error code is set to 1.
Any ideas what I'm doing wrong?
Surely if this was an Apple bug it would have been sorted by now.
Cheers, Art.
Small problem.. I'm checking for both conditions,
Location Services are globally disabled,
or Location Services were not authorised for the App.
I use this code straight after enabling Location Services in the App.
Code:
if (![CLLocationManager locationServicesEnabled]) {errorcode = 1;}
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied) {errorcode = 1;}
if (errorcode == 1) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location Services"
message:@"Functionality of this program is limited to Map Browse Mode without Location Services enabled."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
So if "errorcode" is set to 1 I can go about handling the absence of core location.
Problem is, every time I delete the App from a device, and run it for the first time,
I can deny the App's permission to use Location Services, and errorcode
is not set to 1, and the alert doesn't show, and Location Services are not working.
The second time I run the App, all is well. The alert does show,
and error code is set to 1.
Any ideas what I'm doing wrong?
Surely if this was an Apple bug it would have been sorted by now.
Cheers, Art.