0
Когда я устанавливаю CLlocationManager с этим кодом:Проблемы с CLlocationManager в прошивке 8
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
if([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
[self.locationManager requestAlwaysAuthorization];
// Or [self.locationManager requestWhenInUseAuthorization];
} [self.locationManager startUpdatingLocation];
}
и установить местоположение делегат
#pragma mark - CLLocationManagerDelegate
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
NSLog(@"didFailWithError: %@", error);
UIAlertView *errorAlert = [[UIAlertView alloc]
initWithTitle:@"Error" message:@"Failed to Get Your Location" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[errorAlert show];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
NSLog(@"didUpdateToLocation: %@", newLocation);
CLLocation *currentLocation = newLocation;
if (currentLocation != nil) {
self.textLongitude.text = [NSString stringWithFormat:@"%.8f", currentLocation.coordinate.longitude];
self.textLatitude.text = [NSString stringWithFormat:@"%.8f", currentLocation.coordinate.latitude];
}
}
Don't отправить уведомление для авторизованный, но Info.plist завершен
при переходе к настройкам и изменении настроек -> конфиденциальность -> локализовать и изменить статус для «всегда» и перезапустить приложение, этот статус чист.
Очень-очень СПАСИБО – Bu56