0

I have developed an App where I am trying to get current device location in delegate method "applicationDidBecomeActive" and it is working fine, but the issue came up when I tested my same code on Xcode 8 beta 6 and iOS beta 10.7. Screen was bombarded by continous Alerts saying "Allow "App" to access your location while you use the app". I am not able to click on "Allow"/"Don't Allow". My code is:

-(void) startLocationService {
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];

if (![CLLocationManager locationServicesEnabled] || status == kCLAuthorizationStatusDenied || status == kCLAuthorizationStatusRestricted) {
    DLog(@"Locations disabled or status not permiting use of locations systems.");
    self.currentLocation = nil;
    [self sendNotificationforErrorMessage:ERROR_MSG_LOCATION_SERVICE];
}
else {
    [self createLocationManager];

    if ([locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
        if (status == kCLAuthorizationStatusNotDetermined) {
            [locationManager requestWhenInUseAuthorization];
        }
    }
    else {
        [self startLocationManager];
    }
}
}

-(void)createLocationManager {
self.currentLocation = nil;
locationManager = [[CLLocationManager alloc] init];
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
locationManager.delegate = self;
}

-(void)startLocationManager {
[locationManager startUpdatingLocation];
[self performSelector:@selector(locationServiceTimedout)
           withObject:nil
           afterDelay:timeOutValue];
}

SCENARIOS I HAVE TESTED: 1) Compiled the App in Xcode8 beta6 and ran successfully on iOS 9 device 2) Compiled the App in Xcode8 beta6 and got bombarded with alerts on iOS10 device.

I have tried googling it but no luck. Any pointer is highly appreciated.

Pranav Wadhwa
  • 7,666
  • 6
  • 39
  • 61
codejunkie
  • 53
  • 2
  • 10

1 Answers1

0

Try this

Go to the info.plist

add key

Privacy - Location Always Usage Description

or

Privacy - Location Usage Description

or

Privacy - Location When In Use Usage Description

add a description to the right.

Ro4ch
  • 850
  • 8
  • 21