谁能告诉我为什么这段代码没有被执行?我从我的另一个项目中复制并粘贴了它,它工作得很好。我还在我的其他应用程序中尝试使用与我在这里插入的相同地址字符串,它运行良好。但是如果我将地址直接传递给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。