iOS6から CoreLocation の didUpdateToLocation が使えなくなったらしい。
didUpdateLocations を使えと言われるが
なんか引数がちがう。
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
- (void)locationManager:(CLLocationManager *)manager
didUpdateLocations:(NSArray *)locations
didUpdateToLocation の newLocation は
[locations lastObject] でとれるらしい。
- (void) locationManager:(CLLocationManager *)managerのようにすると newLocation がとれるんだって。
didUpdateLocations:(NSArray *)locations{
CLLocation *newLocation = [locations lastObject];
}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(I've added English translated text for some traffic from US.)
"didUpdateToLocation" method has been obsolete from iOS6.
Alternatively "didUpdateLocations" has been available but parameters are different.
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
- (void)locationManager:(CLLocationManager *)managerWhen you want "newLocation" in "didUpdateToLocation", you can use [locations lastObject] like below.
didUpdateLocations:(NSArray *)locations
- (void) locationManager:(CLLocationManager *)manager
didUpdateLocations:(NSArray *)locations{
CLLocation *newLocation = [locations lastObject];
}