I am very new to IOS programming. Just learning really. I have a simple question.

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
Has been replaced in iOS6 with:
- (voi)(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
which makes locations an array. From the doccumentation i see the way to get the latest object out of the array is by using

- (id) lastObject

As a newbie this means nothing to me yet about usage. How do I assign the last object to a variable? My guess is this, but I think it was wrong, because its not working. Heres the methid I was trying:

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
        //how many seconds ago was this new location created
    CLLocation *loc = [locations lastObject];
    NSLog(@"%@", loc);
    NSTimeInterval t = [[loc timestamp] timeIntervalSinceNow];
    if (t < -180) {
    [self foundLocation:loc];
this is a lesson in BigNerdRanch books, but they are iOS5...