【问题标题】:Getting wrong cordinates when tracked via Cellular data packet通过蜂窝数据包跟踪时获取错误坐标
【发布时间】:2013-12-06 05:31:45
【问题描述】:

我正在尝试通过 LocationManager 获取坐标。当我在 WIFI 网络上时,我得到了完美的位置。但是当我切换到蜂窝数据时得到不正确的位置(距离我当前位置 500m 的半径)。我尝试了“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];}

【问题讨论】:

  • 您是在静态位置检查这个吗?
  • 不。我正在设备上试用。
  • 这可能有 2 个原因.. 1) 您的 SIM 卡上未启用网络.. 2) 手机信号塔有问题.. 在办公室以外的其他位置检查您的应用程序..还可以尝试禁用 wifi,然后使用蜂窝数据进行检查。
  • 互联网连接没有问题。一切安好。我正在获取坐标,但半径约为 500m
  • 是的,Dinesh,你说的上述所有组合都试过了。但仍无法获取准确位置。

标签: ios iphone gps core-location cllocationmanager


【解决方案1】:

检查此CLLocationManager responsiveness 但根据 Apple Docs The receiver does its best to achieve the requested accuracy; however, the actual accuracy is not guaranteed. 但 500 米仍然太多

【讨论】:

  • 当我在 iPhone 上查看谷歌地图或其他应用程序时,我得到了正确的位置。 :(
  • Apple 默认不再使用谷歌地图。因此,与谷歌地图和苹果本地地图进行比较是没有用的,因为它们都有不同的基站和 wifi 位置数据库。我目前不确定,但看起来这是苹果地图数据库中错误的手机信号塔位置的问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-09-30
  • 2014-11-11
  • 1970-01-01
  • 2014-10-25
  • 2019-10-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多