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.