【发布时间】:2012-10-09 05:31:31
【问题描述】:
以下代码仅返回前 10 个地址的坐标。但我需要超过 100 个才能将其存储在数据库中。地理编码器有限制吗?我该怎么做?
for(int i=0;i<count;i++)
{
CLGeocoder *geoCode = [[CLGeocoder alloc] init];
[geoCode geocodeAddressString:strcity completionHandler:^(NSArray *placemarks, NSError *error)
{
if (!error)
{
CLPlacemark *place = [placemarks objectAtIndex:0];
CLLocation *location = place.location;
CLLocationCoordinate2D coord = location.coordinate;
NSString *tempLati=[[NSString alloc]initWithFormat:@"%g",coord.latitude];
NSString *tempLongi=[[NSString alloc]initWithFormat:@"%g",coord.longitude];
[objCountries.countryLatitude addObject:tempLati];
[objCountries.countryLongitude addObject:tempLongi];
[geoCode cancelGeocode];
}
}];
}
【问题讨论】:
标签: iphone objective-c mapkit clgeocoder