What location manager is offering as its recent value

百般思念 提交于 2019-12-11 14:04:16

问题


I asked a question regarding how to get old location from this:

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations 

And I got reply

You should create and use a mutable array of previous locations that were updated from previous calls to "locationManager: didUpdateLocations:". Link

Now I am confused regarding that in Location Awareness guide Apple says this:

If a location update has already been delivered, you can also get the most recent location data directly from the CLLocationManager object without waiting for a new event to be delivered.

I am not getting this point. Please help me out.


回答1:


If you look at Apple's documentation for CLLocationManager, you'll see it has a property you can access that's named "location".

This property contains the last reported location data.

And whenever new locations gets resolved & reported, that property should presumably be updated.

In general though, you'll want to keep your users up-to-date on the current location via updates passed through the delegate methods.



来源:https://stackoverflow.com/questions/16263392/what-location-manager-is-offering-as-its-recent-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!