位置管理器在iPhone中找到当前位置后会重复查找当前位置吗?
我是 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无法找到当前位置,是否会再次搜索当前位置?
我想知道这两种情况
iPhone 是否确定当前位置。
如果 iPhone 无法确定当前位置。
I am new to iPhone development. I want to know the working process of the CLLocationManager in determining the current location. I have used the below code for the button event to find the current location.
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
self.locationManager.delegate = self; // Tells the location manager to send updates to this object
[locationManager startUpdatingLocation];
IN
- (void)locationManager: (CLLocationManager *)manager didUpdateToLocation: (CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{ }
I have determined the lat and long values and loaded the current location.
It is working fine. If after updating to the new location, will it be once again called to get the current location? If iPhone is not able to find the current location, will then once again search for current location?
I want to know for both cases
If iPhone determines the current location.
If iPhone doesn't able to determine the current location.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 CoreLocationManager 参考
这似乎表明(1)您可能会在它仍在尝试确定您当前位置时收到缓存的位置信息,(2)您可能会收到多个更新,因为它会更准确地确定位置。
According to the CoreLocationManager reference
That seems to indicate that (1) you may received cached location information while it's still trying to determine your current location, (2) you may receive multiple updates as it determines the location more accurately.