Updated codes for those using Xcode5


#1

I think we should start a thread for baffled Xcoders using Xcode5

Here are some…

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation

…is in Xcode5…

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

Instead of newLocation argument in the old version, you can use the “location” property of manager argument.
There’s no need to send [locations lastObject] because it’s the same thing as [manager location] (or manager.location)

Following is the last stub you have to enter in Chapter 5.

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
    NSLog(@"%@", manager.location);
    
    NSTimeInterval t = [[manager.location timestamp] timeIntervalSinceNow];
    if (t < -180) {
        return;
    }
    
    [self foundLocation:manager.location];
}

#2

These changes are not relevant to Xcode 5, they are relevant to the version of iOS in which they were changed (iOS 6 for these I believe), so it is more that the book you are working through is slightly out of date.