以下地址的 geocodeAddressString 不是 运行
geocodeAddressString is not running for the following address
如果我为该方法提供任何地址,它根本就不是 calling.But 如果提供“1800 Ellis St,San Francisco,CA 94102,United States”,它就会被调用。告诉我哪里出了问题。
[geocoder geocodeAddressString:@"#83 2nd Floor Diagonal Road V.V.Puram Bangalore 560004 India"
completionHandler:^(NSArray* placemarks1, NSError* error){
for (CLPlacemark* aPlacemark in placemarks1)
{
annotationCoord= aPlacemark.location.coordinate;
[locationManager stopUpdatingLocation];
MKCoordinateRegion region;
region.center.latitude=annotationCoord.latitude;
region.center.longitude=annotationCoord.longitude;
region.span.longitudeDelta=0.;
region.span.latitudeDelta=0.;
self.mapView.showsUserLocation = YES;
[self.mapView setRegion:region];
_annotation=[[LDAnnotation alloc]initWithCoordinate:annotationCoord andTitle:@""subTitle:@""];
[self.mapView addAnnotation:(id<MKAnnotation>)_annotation];
[_searchAddressTF resignFirstResponder];
}
}];
你的 placemarks1 数组可能是空的,因为你没有检查它是否是空的,块只是没有执行。这是常用格式
[self.geocoder geocodeAddressString:address completionHandler:^(NSArray *placemarks, NSError *error) {
if ([placemarks count] > 0) {
CLPlacemark *placemark = [placemarks objectAtIndex:0];
CLLocation *location = placemark.location;
CLLocationCoordinate2D coordinate = location.coordinate;
您可以尝试打印地标的大小。如果您还没有看到它,请查看此页面。 http://code.tutsplus.com/tutorials/forward-geocoding-with-clgeocoder--mobile-11011
如果我为该方法提供任何地址,它根本就不是 calling.But 如果提供“1800 Ellis St,San Francisco,CA 94102,United States”,它就会被调用。告诉我哪里出了问题。
[geocoder geocodeAddressString:@"#83 2nd Floor Diagonal Road V.V.Puram Bangalore 560004 India"
completionHandler:^(NSArray* placemarks1, NSError* error){
for (CLPlacemark* aPlacemark in placemarks1)
{
annotationCoord= aPlacemark.location.coordinate;
[locationManager stopUpdatingLocation];
MKCoordinateRegion region;
region.center.latitude=annotationCoord.latitude;
region.center.longitude=annotationCoord.longitude;
region.span.longitudeDelta=0.;
region.span.latitudeDelta=0.;
self.mapView.showsUserLocation = YES;
[self.mapView setRegion:region];
_annotation=[[LDAnnotation alloc]initWithCoordinate:annotationCoord andTitle:@""subTitle:@""];
[self.mapView addAnnotation:(id<MKAnnotation>)_annotation];
[_searchAddressTF resignFirstResponder];
}
}];
你的 placemarks1 数组可能是空的,因为你没有检查它是否是空的,块只是没有执行。这是常用格式
[self.geocoder geocodeAddressString:address completionHandler:^(NSArray *placemarks, NSError *error) {
if ([placemarks count] > 0) {
CLPlacemark *placemark = [placemarks objectAtIndex:0];
CLLocation *location = placemark.location;
CLLocationCoordinate2D coordinate = location.coordinate;
您可以尝试打印地标的大小。如果您还没有看到它,请查看此页面。 http://code.tutsplus.com/tutorials/forward-geocoding-with-clgeocoder--mobile-11011