Я использую CLLocationManager
для захвата местоположения. Хотя I have GPS settings working on my device
, он показывает случайное всплывающее состояние, которое определено в didFailWithError
Ошибка, которую я получаю,
Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)"
-(void) startGettingCurrentLocation {
CLLocationManager *locationManager=[[CLLocationManager alloc] init];
locationManager.delegate=self;
locationManager.desiredAccuracy=kCLLocationAccuracyNearestTenMeters;
[locationManager startUpdatingLocation];
}
- (void) locationManager:(CLLocationManager *) manager didFailWithError:(NSError *)error {
[locatingAlert dismissWithClickedButtonIndex:0 animated:NO];
UIAlertView *statusAlert;
statusAlert = [[UIAlertView alloc] initWithTitle:@"" message:@"In order to use this application properly, you need to allow use of the GPS." delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
[statusAlert addButtonWithTitle:@"OK"];
[statusAlert show];
//Set Default Coordinates it app not able to get location
if (mainDelegate.currentLatitude == nil) {
mainDelegate.currentLatitude = @"28.6317021";
}
if (mainDelegate.currentLongitude == nil) {
mainDelegate.currentLongitude = @"-81.423110";
}
}