Created
October 15, 2012 18:40
-
-
Save kenichi/3894267 to your computer and use it in GitHub Desktop.
deprecated CLLocationManager didUpdateToLocation:fromLocation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation | |
{ | |
NSMutableArray *locations = [NSMutableArray arrayWithObject:newLocation]; | |
if (oldLocation) [locations insertObject:oldLocation atIndex:0]; | |
[self locationManager:locationManager didUpdateLocations:locations]; | |
} | |
// --- or the other way around | |
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations | |
{ | |
CLLocation *newLocation = [locations objectAtIndex:locations.count - 1]; | |
CLLocation *oldLocation = nil; | |
if (locations.count > 1) | |
oldLocation = [locations objectAtIndex:locations.count - 2]; | |
[self locationManager:locationManager didUpdateToLocation:newLocation fromLocation:oldLocation]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment