• iOS 使用CLGeocoder获取地理位置


    placemark(MKPlacemark类的对象)其实是geocoder(MKReverseGeocoder类的对象)的一个属性。从geocoder里面取placemark这个和直接取placemark这个其实区别不大。而我们需要的信息主要就在这个里面了。

    // 这个字典存放基础数据

    @property (nonatomic, readonly) NSDictionary *addressDictionary;

    让我们试试看,能从这个字典里面倒出来些什么东西。

    以下是我用这个addressDictionary属性倒出来的字典。我们分析看看。

    {

        City = "U897fU5b89U5e02";// 城市名字

        Country = "U4e2dU56fd";// 国家名字

        CountryCode = CN;// 国家编码

        FormattedAddressLines =     (

            "U4e2dU56fd",

            "U9655U897fU7701U897fU5b89U5e02U96c1U5854U533a",

            "U9ad8U65b0U516dU8def34U53f7"

        ); // 这个应该是格式化后的地址了

        State = "U9655U897fU7701"; // 省

        Street = "U9ad8U65b0U516dU8def 34U53f7";// 街道完整名称

        SubLocality = "U96c1U5854U533a";//区名 

       SubLocality = "U6816U971eU533a";

        SubThoroughfare = "34U53f7";//具体地址

        Thoroughfare = "U9ad8U65b0U516dU8def";//街道名称

    }

     

    注意:上面的这个字典是可以直接转化为联系人的字典的,通过这个ABCreateStringWithAddressDictionary属性。

     

    以下是placemark的其他属性。大家可以随意取用。

    // address dictionary properties

    @property (nonatomic, readonly) NSString *name; // eg. Apple Inc.

    @property (nonatomic, readonly) NSString *thoroughfare; // street address, eg. 1 Infinite Loop

    @property (nonatomic, readonly) NSString *subThoroughfare; // eg. 1

    @property (nonatomic, readonly) NSString *locality; // city, eg. Cupertino

    @property (nonatomic, readonly) NSString *subLocality; // neighborhood, common name, eg. Mission District

    @property (nonatomic, readonly) NSString *administrativeArea; // state, eg. CA

    @property (nonatomic, readonly) NSString *subAdministrativeArea; // county, eg. Santa Clara

    @property (nonatomic, readonly) NSString *postalCode; // zip code, eg. 95014

    @property (nonatomic, readonly) NSString *ISOcountryCode; // eg. US

    @property (nonatomic, readonly) NSString *country; // eg. United States

    @property (nonatomic, readonly) NSString *inlandWater; // eg. Lake Tahoe

    @property (nonatomic, readonly) NSString *ocean; // eg. Pacific Ocean

    @property (nonatomic, readonly) NSArray *areasOfInterest; // eg. Golden Gate Park

     

  • 相关阅读:
    深入浅出 Redis client/server 交互流程
    VMware三种网络连接模式(转载)
    ARP 原理及攻击
    symbol lookup error:undefined symbol
    printf 颜色格式串"33[34;1m"
    运行openvas
    openvas 安装
    升级openssl 支持TLS1.2
    Windows登录密码明文获取器
    Linux字符串截取和处理命令 cut、printf、awk、sed、sort、wc
  • 原文地址:https://www.cnblogs.com/niit-soft-518/p/4052366.html
Copyright © 2020-2023  润新知