我的代码用于高尔夫选手应用。我需要确切的用户位置,这是我当前的代码
- (void) update_location
{
locationManager_player = [[CLLocationManager alloc] init];
locationManager_player.delegate = self;
locationManager_player.desiredAccuracy = kCLLocationAccuracyBest;
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
[locationManager_player requestWhenInUseAuthorization];
}
[locationManager_player startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
// Code to handle the current user location
}
上述委托方法未提供确切的用户位置。也许这给出了距用户当前位置30到40码的距离的坐标
预先感谢
答案 0 :(得分:0)
位置精度由desiredAccuracy
的{{1}}属性控制。检查您的情况设置。默认值为CLLocationManager
。您可以将其设置为kCLLocationAccuracyBest
,但需要更多的电源。
更多详细信息here。