首页 文章

iPhone - LocationManager没有't converge even though a user' s位置服务?

提问于
浏览
0

有没有人知道什么可能导致locationManager不收敛到一个值,即使位置服务已启用?

Edit 1 - The locationManager works fine for some users, but for other users their location never gets updated. And the user's device, whose location never gets updated, has GPS since the devices are iPhone 5, iPad3, iPhone 4, etc. I'm wondering if they are too far out in the country and always indoors. so GPS, WiFi, cell towers don't reach them? But somehow they get online....

Edit 2 - More clarification: The user has internet access as they are able to make a new account on my web server. And when locationManager has converged on a value, using #2 below, then the gps location on my web server is updated but that never happens. The user is on the device in the app long enough to answer 10 questions and upload their photo. Is that not enough time for locationManager to converge if the user has internet access?

Edit 3 - Another weird thing happens: On the website when the user's account is created, the users's gps_lat is set to 0. When the user does update his gps_lat on the website using locationManager from the iPhone, the updated value for gps_lat is (null). What could cause locationManager to produce output = (null)?

  • 我使用以下代码检查位置服务是否已启用:
BOOL locationServicesDenied    = ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied);
  • 然后当locationManager与此代码融合时,我更新用户在网站上的位置:
  • (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {if((newLocation.horizontalAccuracy> 0.0f)&&(newLocation.horizontalAccuracy <7000.0f){
    [self update_website:self];
    }

但是update_website永远不会被调用 . 这让我觉得newLocation.horizontalAccuracy永远不会低于7000 .

有没有人知道为什么即使位置服务打开,locationManager也无法收敛?

2 回答

  • 3

    如果没有错误并且GPS没有足够的信号来计算位置,则不会调用代表 . GPS将继续尝试获取位置,但如果设备在地下(例如),它将什么都没有(除非有缓存的位置) .

    你在等待足够长的时间吗?即使设备具有GPS信号但没有数据网络(WiFi /小区),位置管理器也无法通过数据网络获得卫星星历 . 获得GPS位置需要更长的时间,2到10分钟 . 辅助GPS速度要快得多,但需要数据连接 .

  • 0

    您是否设置了位置管理器的 delegate 属性并在其上调用 startUpdatingLocation

    [myLocationManager setDelegate:self];
    [myLocationManager startUpdatingLocation];
    

    编辑:我认为这只是在测试设备上发生的 . 如果它在用户设备上,则完全有可能精度可能超过7000米 . 如果用于修复的唯一东西是蜂窝无线电(没有GPS,没有WiFi),则精度大约为1-10k,具体取决于蜂窝塔的密度 . 在线用户(以太网或WiFi)不保证其WiFi位于已知(和映射)点的数据库中 .

相关问题