does it help or hurt?
I've been trying to find any way to optimize the performance of my location-based iPhone application and have seen some people mention that you can force location updates by starting and stopping your CLLocationManager. I need the best accuracy I can get, and the user in my case would probably like to see updates every few seconds (say, 10 seconds) as they walk around. I've set the filters accordingly, but I notice that sometimes I don't get any updates on the device for quite some time.
I'm testing the following approach, which forces an update when a fixed time interval passes (I'm using 20 seconds). My gut tells me this really won't help me provide more accurate updates to the user, and that just leaving CLLocationManager running all the time is probably the best approach.
- (void)forceLocationUpdate {
[[LocationManager locationManager] stopUpdates];
[[LocationManager locationManager] startUpdates];
[self performSelector:@selector(forceLocationUpdate) withObject:nil afterDelay:20.0];
}
My question is- does forcing updates from CLLocationManager actually improve core location performance? Does it hurt performance? If I'm outside in an open field with good GPS reception, will this help then? Does anyone have experience trying this?
Thanks in advance, Steve
我还试图在应用程序中优化“靠近我”功能 - 我发现以下SO发布信息有用:链接文本
Chances are if you have your desired accuracy and distance filter set correctly, then you aren't getting any updates because your user or test hasn't moved enough to trigger an update. Like the comment from @Nate said, if you set it to best or bestForNav, you have a better chance of getting more updates.
The real reason for shutting down your location manager is really to conserve battery. Most users that are using the device for GPS and nav know to keep it plugged in. If you aren't using location for something like that, you are better off getting your location and shutting it down to save battery until you need another location update. This can be done via timers or blocks. The main thing is to think about how you can operate and save as much battery as possible.
链接地址: http://www.djcxy.com/p/20336.html上一篇: 为什么我的CLLocationmanager委托没有被调用?
下一篇: 它有助于还是伤害?