Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
location manager在iPhone中找到当前位置后是否会重复找到当前位置?_Iphone_Geolocation_Maps - Fatal编程技术网

location manager在iPhone中找到当前位置后是否会重复找到当前位置?

location manager在iPhone中找到当前位置后是否会重复找到当前位置?,iphone,geolocation,maps,Iphone,Geolocation,Maps,我是iPhone开发新手。我想知道CLLocationManager在确定当前位置时的工作流程。我使用下面的按钮事件代码来查找当前位置 self.locationManager = [[[CLLocationManager alloc] init] autorelease]; self.locationManager.delegate = self; // Tells the location manager to send updates to this object [location

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

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

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

[locationManager startUpdatingLocation];

我已经确定了lat和long值,并加载了当前位置

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

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

[locationManager startUpdatingLocation];
它工作得很好。如果在更新到新位置后,是否会再次调用它以获取当前位置?如果iPhone找不到当前位置,是否会再次搜索当前位置

我想知道这两种情况

  • 如果iPhone确定当前位置

  •  self.locationManager = [[[CLLocationManager alloc] init] autorelease];
    
    self.locationManager.delegate = self; // Tells the location manager to send updates to this object
    
    [locationManager startUpdatingLocation];
    
  • 如果iPhone无法确定当前位置

  •  self.locationManager = [[[CLLocationManager alloc] init] autorelease];
    
    self.locationManager.delegate = self; // Tells the location manager to send updates to this object
    
    [locationManager startUpdatingLocation];
    
    根据

    位置服务返回一个 尽可能快地确定初始位置 可能,返回缓存信息 如果可以的话。交货后 初始事件通知 CLLocationManager对象可能会传递 如果最小值为 阈值距离(按照 distanceFilter属性)为 超出或更准确的位置 价值是确定的

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