Skip to content

Commit 4ffd602

Browse files
committed
Flip check for location services enabled
1 parent 1819cc8 commit 4ffd602

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

sample-code/apps/TestApp/Test App 2/MyViewControllerViewController.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ - (void)viewDidLoad
5757
secondArg.returnKeyType = UIReturnKeyDone;
5858
firstArg.delegate = self;
5959
secondArg.delegate = self;
60-
[NSTimer scheduledTimerWithTimeInterval:0.1
60+
[NSTimer scheduledTimerWithTimeInterval:0.2
6161
target:self
6262
selector:@selector(logLocationAuthFromTimer:)
6363
userInfo:nil
@@ -68,7 +68,7 @@ - (void)viewDidLoad
6868
[computeSumButton setAccessibilityIdentifier:@"ComputeSumButton"];
6969
[answerLabel setAccessibilityIdentifier:@"Answer"];
7070
[locationStatus setAccessibilityIdentifier:@"locationStatus"];
71-
71+
7272
UISwipeGestureRecognizer * swipe =[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeUp:)];
7373
swipe.direction = UISwipeGestureRecognizerDirectionUp;
7474
[self.view addGestureRecognizer:swipe];
@@ -91,7 +91,7 @@ - (void)logLocationAuthFromTimer:(NSTimer *)timer
9191
- (void)logLocationAuth
9292
{
9393
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
94-
if (status == kCLAuthorizationStatusAuthorized) {
94+
if (status != kCLAuthorizationStatusRestricted && status != kCLAuthorizationStatusDenied) {
9595
locationStatus.on = YES;
9696
} else {
9797
locationStatus.on = NO;
@@ -181,7 +181,7 @@ - (IBAction)accessContactsAlert:(id)sender {
181181

182182
- (IBAction)accessLocationAlert:(id)sender {
183183
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
184-
184+
185185
[locationManager startUpdatingLocation];
186186
[locationManager stopUpdatingLocation];
187187
}

0 commit comments

Comments
 (0)