Dre*_*rew 5 xcode objective-c geolocation reverse-geocoding ios
第一次进行地理定位查找,我想返回用户当前所在的位置。不是在地图上,而是检索状态信息并根据他们的位置在应用程序中为他们提供选项。
当我使用 reverseGeocodeLocation 查找时,我发现它正在查找大量数据......这很棒。具体来说,我想要完整的州名而不是缩写(即加利福尼亚州与加利福尼亚州)。
唯一的问题是,当 placemark.administrativeArea 的 NSLog 只显示缩写“CA”时。
查看开发文档,它说:
“例如,如果地标位置是 Apple 的总部,则此属性的值将是字符串“CA”或“California”。
当我将整个地标转储到日志中时,我看到了加利福尼亚。这一定是一个愚蠢的问题……我到底做错了什么?
提前致谢!
structuredAddress: Apple Inc.<GEOMapItemStorage: 0x7a680f70> {
placeData = {
component = (
{
"cache_control" = CACHEABLE;
"start_index" = 0;
status = "STATUS_SUCCESS";
ttl = 15768000;
type = "COMPONENT_TYPE_HOURS";
"values_available" = 0;
version = 7;
"version_domain" = (
apple,
revgeo,
US
);
},
{
"cache_control" = CACHEABLE;
"start_index" = 0;
status = "STATUS_SUCCESS";
ttl = 15768000;
type = "COMPONENT_TYPE_RATING";
"values_available" = 0;
version = 7;
"version_domain" = (
apple,
revgeo,
US
);
},
{
"cache_control" = CACHEABLE;
"start_index" = 0;
status = "STATUS_SUCCESS";
ttl = 15768000;
type = "COMPONENT_TYPE_FLYOVER";
"values_available" = 0;
version = 7;
"version_domain" = (
apple,
revgeo,
US
);
},
{
"cache_control" = CACHEABLE;
"start_index" = 0;
status = "STATUS_SUCCESS";
ttl = 15768000;
type = "COMPONENT_TYPE_BOUNDS";
value = (
{
bounds = {
"map_region" = {
eastLng = "-122.0278321145097";
northLat = "37.33399909402007";
southLat = "37.33029506903731";
westLng = "-122.0347313625158";
};
};
}
);
"values_available" = 1;
version = 7;
"version_domain" = (
apple,
revgeo,
US
);
},
{
"cache_control" = CACHEABLE;
"start_index" = 0;
status = "STATUS_SUCCESS";
ttl = 15768000;
type = "COMPONENT_TYPE_ROAD_ACCESS_INFO";
"values_available" = 0;
version = 7;
"version_domain" = (
apple,
revgeo,
US
);
},
{
"cache_control" = CACHEABLE;
"start_index" = 0;
status = "STATUS_SUCCESS";
ttl = 15768000;
type = "COMPONENT_TYPE_PLACE_INFO";
value = (
{
"place_info" = {
center = {
lat = "37.3320289";
lng = "-122.029566";
};
timezone = {
identifier = "America/Los_Angeles";
};
};
}
);
"values_available" = 1;
version = 7;
"version_domain" = (
apple,
revgeo,
US
);
},
{
"cache_control" = CACHEABLE;
"start_index" = 0;
status = "STATUS_SUCCESS";
ttl = 15768000;
type = "COMPONENT_TYPE_ENTITY";
value = (
{
entity = {
name = (
{
locale = "en_US";
"string_value" = "Apple Inc.";
},
{
locale = en;
"string_value" = "Apple Inc.";
}
);
type = AOI;
};
}
);
"values_available" = 1;
version = 7;
"version_domain" = (
apple,
revgeo,
US
);
},
{
"cache_control" = CACHEABLE;
"start_index" = 0;
status = "STATUS_SUCCESS";
ttl = 15768000;
type = "COMPONENT_TYPE_ADDRESS";
value = (
{
address = {
"localized_address" = (
{
address = {
formattedAddressLine = (
"Apple Inc.",
"Cupertino, CA 95014",
"United States"
);
structuredAddress = {
administrativeArea = California;
administrativeAreaCode = CA;
areaOfInterest = (
"Apple Inc."
);
country = "United States";
countryCode = US;
dependentLocality = (
Cupertino,
"Bay Area"
);
geoId = (
);
locality = Cupertino;
postCode = 95014;
subAdministrativeArea = "Santa Clara";
subLocality = "Bay Area";
};
};
locale = "en_US";
},
{
address = {
formattedAddressLine = (
"Apple Inc.",
"Cupertino, CA 95014",
"United States"
);
structuredAddress = {
administrativeArea = California;
administrativeAreaCode = CA;
areaOfInterest = (
"Apple Inc."
);
country = "United States";
countryCode = US;
dependentLocality = (
Cupertino,
"Bay Area"
);
geoId = (
);
locality = Cupertino;
postCode = 95014;
subAdministrativeArea = "Santa Clara";
subLocality = "Bay Area";
};
};
locale = en;
}
);
};
}
);
"values_available" = 1;
version = 7;
"version_domain" = (
apple,
revgeo,
US
);
},
{
"cache_control" = CACHEABLE;
"start_index" = 0;
status = "STATUS_SUCCESS";
ttl = 15768000;
type = "COMPONENT_TYPE_AMENITIES";
"values_available" = 0;
version = 7;
"version_domain" = (
apple,
revgeo,
US
);
},
{
"cache_control" = CACHEABLE;
"start_index" = 0;
status = "STATUS_SUCCESS";
ttl = 15768000;
type = "COMPONENT_TYPE_STYLE_ATTRIBUTES";
"values_available" = 0;
version = 7;
"version_domain" = (
apple,
revgeo,
US
);
}
);
"result_provider_id" = 7618;
status = "STATUS_SUCCESS";
};
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
838 次 |
| 最近记录: |