有谁能告诉我为什么这段代码没有被执行?我从我的另一个项目中复制并粘贴它,它的工作正常。我也尝试在我的其他应用程序中使用相同的addressString我插入这里,它完美地工作。但是如果我将地址直接传递给geocodeaddressstring,那么它在传递字符串变量时会发生它正常工作
NSString *addressString = @"2642 Broadway, New York, NY 10025, USA";
[forwardGeocoder1 geocodeAddressString:addressString
completionHandler:^(NSArray *placemarks, NSError *error){
// Make sure the geocoder did not produce an error
// before continuing
if(!error){
// Iterate through all of the placemarks returned
// and output them to the console
for(CLPlacemark *placemark in placemarks){
NSLog(@"found");
}
}
else{
// Our geocoder had an error, output a message
// to the console
NSLog(@"There was a forward geocoding error\n%@",
[error localizedDescription]);
}
}
];
错误:
kCLErrorDomain错误8。