How to get formatted address NSString from AddressDictionary?

前端 未结 9 1401
旧巷少年郎
旧巷少年郎 2020-12-17 14:58

Trying to get formatted address from AddressDictionary, that I got from CLGeocoder. Used following code with no result:

subtitle = [NSString stringWithString         


        
9条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-17 15:44

    The documentation for the addressDictionary property says:

    You can format the contents of this dictionary to get a full address string as opposed to building the address yourself. To format the dictionary, use the ABCreateStringWithAddressDictionary function as described in Address Book UI Functions Reference.

    So add and import the AddressBookUI framework and try:

    subtitle = 
        ABCreateStringWithAddressDictionary(placemark.addressDictionary, NO);
    

提交回复
热议问题