Question: Since I have updated my ios to 7.I dont know how get the current location and altitude with the new method

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

```

Can Any one show me some sample code how to use this method to get current location and altitude?

Thanks a LOT.

Answer: 
The most recent location will be at the end of the `locations` array.

```
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
    CLLocation *mostRecentLocation = [locations lastObject];
    bool haveValidAltitude = (mostRecentLocation.verticalAccuracy > 0);
    if(haveValidAltitude)
    {
        NSLog(@"current altitude is: %g meters above sea level", mostRecentLocation.altitude);
    }else{
        NSLog(@"current altitude is unavailable");
    }
}

```
```
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
    CLLocation *location = [locations lastObject];
    NSLog(@"latitude %+.6f, longitude %+.6f\n", location.coordinate.latitude, location.coordinate.longitude);
}

```

`locations` is an array, last object of which is the newest available location.