When iOS 6 launched last year, Apple deprecated a commonly used method from the CLLocationManagerDelegate protocol. The method deprecated is – (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation and is used to tell the delegate that a new location is available. Each time a location change is detected, this method is called and within the method, you can trigger certain methods or updates to happen as needed.
This was done by using the (CLLocation *)newLocation details. With this method being deprecated in iOS 6, Apple recommends you now use a newer method called – (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations. Rather than providing a newLocation as a CLLocation, this new method returns an NSArray of locations. As the value is a different type, you will need to modify your code to account for the data being handed back in an NSArray.
The good news is that according to the documentation, you still get a CLLocation object, but instead of accessing it direct, you need to pull it out of the NSArray to action it. Lets take a look at some code that will help you do just that. [Read more…]