ios - 通过蜂窝数据包跟踪时得到错误的坐标

标签 ios iphone gps core-location cllocationmanager

我正在尝试通过 LocationManager 获取坐标。当我在 WIFI 网络上时,我得到了完美的位置。但是当我切换到蜂窝数据时,得到的位置不正确(在我当前位置的 500 米半径范围内)。我尝试了“desiredAccuracy”的所有组合,但未能获得准确的坐标。有什么解决办法吗?

locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
currentLocation = nil;
[locationManager startUpdatingLocation];



 - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{if(currentLocation != nil)
    currentLocation = NULL;


NSTimeInterval locationAge = -[newLocation.timestamp timeIntervalSinceNow];

NSLog(@"Location age %f", locationAge);

if (locationAge > 0.1) return;


currentLocation = [[CLLocation alloc] initWithLatitude:newLocation.coordinate.latitude longitude:newLocation.coordinate.longitude];
NSLog(@"current location - %@",currentLocation);



NSString *lat =[NSString stringWithFormat:@"%lf",currentLocation.coordinate.latitude];
NSString *lon =[NSString stringWithFormat:@"%lf",currentLocation.coordinate.longitude];

latitudeText.text = lat;
longitudeText.text = lon;
[manager stopUpdatingLocation];}

最佳答案

检查这个CLLocationManager responsiveness但是根据 Apple Docs ,接收器会尽力达到要求的精度;但是,不能保证实际精度。但是 500 米还是太多了

关于ios - 通过蜂窝数据包跟踪时得到错误的坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20416702/

相关文章:

iphone - iphone NSString 的问题

ios - 访问选项卡栏 Controller 中的选项卡元素并更改值

Android:getSpeed 是否返回用户的速度?

android - 我无法在 android 上运行应用程序,但模拟器可以

android - .Android GPS 是如何工作的?

ios - iPhone-录制后保存音频时出现问题

ios - Swift 中的 NSUserDefaults 选项

ios - 如何测试和导出使用 LibGDX 制作的 iOS 应用程序

iphone - rippleEffect 是私有(private) Api 吗?操作系统

iphone - Core Data client+server/后台保存/一般导入问题