Skip to content

Instantly share code, notes, and snippets.

@kharmabum
Created February 13, 2014 02:28
Show Gist options
  • Save kharmabum/8968673 to your computer and use it in GitHub Desktop.
Save kharmabum/8968673 to your computer and use it in GitHub Desktop.
Check whether locationServices are enabled.
if ((![CLLocationManager locationServicesEnabled])
|| ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusRestricted)
|| ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied)) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil) message:NSLocalizedString(@"Location services must be enabled in Settings.", nil) delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alertView show];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment