Deprecated object in iOS6


#1

It seems:

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

is now deprecated, and we must use - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations instead.

What should we do at this point of the book?..do we just go on as the book says?

Thanks!!


#2

could this do the same work?

  • (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
    {
    NSLog(@"%@", [locations lastObject]);
    }

…it seems it does…


#3

As each of the objects inside the locations array is an instance of CLLocation, you can grab the last item in the array (which is the most recent location) by doing something like:

CLLocation *location = [locations lastObject];
NSLog(@"Longitude %+.6f, Latitude %+.6f", location.coordinate.longitude, location.coordinate.latitude);

I hope this helps,
Nick
http://myfirstiphoneapp.co.uk
http://easyintervalsapp.co.uk


#4

Thank you guys for posting this. The suggestion by Jorge749 seems to work for me.

Hopefully BNR can do a better job at more prominently displaying such significant errata.