Created
February 13, 2014 02:27
-
-
Save kharmabum/8968665 to your computer and use it in GitHub Desktop.
LocationManager: didChangeAuthorizationStatus: - handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status { | |
NSLog(@"%s", __PRETTY_FUNCTION__); | |
switch (status) { | |
case kCLAuthorizationStatusAuthorized: | |
NSLog(@"kCLAuthorizationStatusAuthorized"); | |
// Re-enable the post button if it was disabled before. | |
self.navigationItem.rightBarButtonItem.enabled = YES; | |
[locationManager startUpdatingLocation]; | |
break; | |
case kCLAuthorizationStatusDenied: | |
NSLog(@"kCLAuthorizationStatusDenied"); | |
{{ | |
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Anywall can’t access your current location.\n\nTo view nearby posts or create a post at your current location, turn on access for Anywall to your location in the Settings app under Location Services." message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:@"Ok", nil]; | |
[alertView show]; | |
// Disable the post button. | |
self.navigationItem.rightBarButtonItem.enabled = NO; | |
}} | |
break; | |
case kCLAuthorizationStatusNotDetermined: | |
NSLog(@"kCLAuthorizationStatusNotDetermined"); | |
break; | |
case kCLAuthorizationStatusRestricted: | |
NSLog(@"kCLAuthorizationStatusRestricted"); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment