1

我在网上彻底搜索,但找不到任何关于此的讨论:

MapKit 搜索返回的MKLocalSearchResponse 对象是MKMapItem 的集合,其中包含搜索结果的信息,例如城市、州、国家。

单个 MKMapItem 看起来像这样(从 Xcode 快速查看对象):

"Name: ADVANCED SOLUTIONS ADDICTION MANAGEMENT CurrentLocation: 0 Place: <GEOPlace: 0x9b2db90> {
            address =     {
                formattedAddressLine =         (
                    \"205 W Crestway Ave\",
                    \"Unit 200\",
                    \"Derby, KS  67037-1850\",
                    \"United States\"
                );
                structuredAddress =         {
                    administrativeArea = Kansas;
                    administrativeAreaCode = KS;
                    country = \"United States\";
                    countryCode = US;
                    dependentLocality =             (
                        Derby,
                        Rockford
                    );
                    fullThoroughfare = \"205 W Crestway Ave\";
                    geoId =             (
                    );
                    locality = Derby;
                    postCode = 67037;
                    postCodeExtension = 1850;
                    postCodeFull = \"67037-1850\";
                    subAdministrativeArea = Sedgwick;
                    subLocality = Rockford;
                    subPremise =             (
                                        {
                            name = 200;
                            type = 0;
                        }
                    );
                    subThoroughfare = 205;
                    thoroughfare = \"W Crestway Ave\";
                };
            };
            }"

我能够检索到我需要的所有信息,除了公寓号码。它包含在“subPremise”部分中,我不知道如何检索。

您可能会建议我从我可以访问的“formattedAddressLines”中检索它,但对于某些结果,该属性是空的,所以我不能依赖它。

我还尝试了“addressDictionary”属性,它包含除了公寓号码之外的所有必要信息,这对我来说非常不体贴。

4

1 回答 1

1

mapItem.placemark.subThoroughfare。注意可能是空的

于 2013-11-09T09:06:10.147 回答