gpt4 book ai didi

ios - CLGeocoder 返回错误 : The operation couldn’t be completed.(kCLErrorDomain 错误 8。)

转载 作者:技术小花猫 更新时间:2023-10-29 10:21:50 32 4
gpt4 key购买 nike

我在获得地址字符串后调用此函数:

[[self geocoder] geocodeAddressString:addressString completionHandler:^(NSArray *placemarks, NSError *error) {
if (error) {
block(nil, nil, error);
} else {
CLPlacemark *placemark = [placemarks onlyObject];
block(placemark, self.name, error);
}
}];

它将地标返回为 nil,将错误返回为:Error Domain=kCLErrorDomain Code=8 “操作无法完成。(kCLErrorDomain 错误 8。)”

我的地址字符串是从这个字典中为 placeDictionary[@"formatted_address"] 检索的:

placeDictionary = 
{
"address_components" = (
{
"long_name" = "Palolem Beach";
"short_name" = "Palolem Beach";
types = (
"natural_feature",
establishment
);
},
{
"long_name" = "South Goa";
"short_name" = "South Goa";
types = (
"administrative_area_level_2",
political
);
},
{
"long_name" = Goa;
"short_name" = GA;
types = (
"administrative_area_level_1",
political
);
},
{
"long_name" = India;
"short_name" = IN;
types = (
country,
political
);
}
);
"adr_address" = "Palolem Beach, <span class=\"region\">Goa</span>";
"formatted_address" = "Palolem Beach, Goa";
geometry = {
location = {
lat = "15.0099648";
lng = "74.02321859999999";
};
viewport = {
northeast = {
lat = "15.012671";
lng = "74.0272093";
};
southwest = {
lat = "15.0050025";
lng = "74.0164053";
};
};
};
icon = "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png";
id = b286a0f7f047e162b3cab2ab3328ce95d26bdb52;
name = "Palolem Beach";
reference = "CnRwAAAAh2ZORbEpxNv5HnZlQRY_VxKLdvAd16OusSwtBlAKibDFP6roT2idnPvm-XRgMlw3iqUsZujVFrOOns76fK9we3Uddt4b3GgcWZoSqSgoYGtbHh1l5PEL_0VAwaUcswomroA3sjd3dN8lXyBSvafrrxIQONHTpwpn6IvGtYZ12pZ5ixoUENbjRTo3dCrN3aoZTM0k5EPXAjA";
types = (
"natural_feature",
establishment
);
url = "https://maps.google.com/maps/place?q=Palolem+Beach&ftid=0x3bbe4551d05b02bb:0x1e1bc67d4b0fbbf5";

即使我使用方法:

[[self geocoder] geocodeAddressDictionary:placeDictionary completionHandler:^(NSArray *placemarks, NSError *error){

}];

它返回同样的错误。

最佳答案

如果 Apple 的 Geocoder 对提供的地址一无所知,就会出现此错误。

根据 Apple documentation代码 8 表示 kCLErrorGeocodeFoundNoResult

关于ios - CLGeocoder 返回错误 : The operation couldn’t be completed.(kCLErrorDomain 错误 8。),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21624712/

32 4 0