-->

What location manager is offering as its recent va

2019-07-26 23:24发布

问题:

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.