【发布时间】:2015-10-20 10:05:30
【问题描述】:
我在我的 iPad 应用程序中使用 CLLocationManager 类来获取当前位置。
我正在使用下面的代码来获取地址详细信息,
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
NSUserDefaults *oIsLocation = [NSUserDefaults standardUserDefaults];
if([oIsLocation boolForKey:@"IsLocation"])
{
NSTimeInterval locationAge = -[newLocation.timestamp timeIntervalSinceNow];
if (locationAge > 5.0) return;
if (newLocation.horizontalAccuracy < 0) return;
if (bestEffortAtLocation == nil || bestEffortAtLocation.horizontalAccuracy > newLocation.horizontalAccuracy)
{
if(bestEffortAtLocation.coordinate.latitude != newLocation.coordinate.latitude && bestEffortAtLocation.coordinate.longitude != newLocation.coordinate.longitude)
{
[self saveLocation:newLocation];
self.bestEffortAtLocation = newLocation;
[self saveUserLocation];
}
}
}
}
我正在做反向地理编码以获取如下详细信息:
NSLog(@"placemark.ISOcountryCode %@",placemark.ISOcountryCode);
NSLog(@"placemark.country %@",placemark.country);
NSLog(@"placemark.postalCode %@",placemark.postalCode);
NSLog(@"placemark.administrativeArea %@",placemark.administrativeArea);
NSLog(@"placemark.locality %@",placemark.locality);
NSLog(@"placemark.subLocality %@",placemark.subLocality);
NSLog(@"placemark.subThoroughfare %@",placemark.subThoroughfare);
placemark.locality 提供城市名称,但不提供全名,例如仅北卡罗来纳州 NC。
当我的客户在美国使用应用程序时,他们得到的是 NC,而不是像“北卡罗来纳州”这样的全名,而圣查尔斯得到的是 St. Charles ETC。
有没有办法得到全名?
【问题讨论】:
标签: ios objective-c cllocationmanager cllocation