【问题标题】:Will location manager find the current location repeatedly after it finds the current location in iPhone?位置管理器在iPhone中找到当前位置后会重复查找当前位置吗?
【发布时间】:2010-05-11 13:05:07
【问题描述】:

我是 iPhone 开发的新手。我想知道 CLLocationManager 在确定当前位置时的工作过程。我已经使用下面的按钮事件代码来查找当前位置。

 self.locationManager = [[[CLLocationManager alloc] init] autorelease];

self.locationManager.delegate = self; // Tells the location manager to send updates to this object

[locationManager startUpdatingLocation];

输入

- (void)locationManager: (CLLocationManager *)manager didUpdateToLocation: (CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{   }

我已经确定了纬度和经度值并加载了当前位置。

它工作正常。如果更新到新位置后,是否会再次调用获取当前位置?如果 iPhone 无法找到当前位置,是否会再次搜索当前位置?

我想知道这两种情况

  1. 如果 iPhone 确定当前位置。

  2. 如果 iPhone 无法确定当前位置。

【问题讨论】:

    标签: iphone geolocation maps


    【解决方案1】:

    根据CoreLocationManager reference

    定位服务返回一个 最快的初始位置 可能,返回缓存信息 有空的时候。交付后 初始事件通知, CLLocationManager 对象可以传递 附加事件,如果最小 阈值距离(由指定 distanceFilter 属性)是 超出或更准确的位置 值是确定的。

    这似乎表明 (1) 您可能会在它仍在尝试确定您的当前位置时收到缓存的位置信息,(2) 您可能会收到多次更新,因为它可以更准确地确定位置。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-06
      • 1970-01-01
      • 1970-01-01
      • 2018-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多