2015-03-18 5 views
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 завершен

enter image description here

при переходе к настройкам и изменении настроек -> конфиденциальность -> локализовать и изменить статус для «всегда» и перезапустить приложение, этот статус чист.

ответ

1

NSLocationAlwaysUsageDescription с ошибкой в ​​plist.

+0

Очень-очень СПАСИБО – Bu56

Смежные вопросы