EmptyStack EmptyStack - 20 days ago 6
Objective-C Question

Contact address format for different countries

In an app, I am displaying the details of the contacts using ABRecordRef. I am using the keys kABPersonAddressCityKey, kABPersonAddressStateKey, kABPersonAddressZIPKey, kABPersonAddressCountryKey. Everything works fine. But I don't know in which format to display the addresses. What I mean is, if you see the Contacts app, the addresses are displayed in a particular format for different countries. Some examples,

US


Street

City State ZIP

Country


India


Street

Province

City PIN

Country


Australia


Street

Suburb State ZIP

Country


Now I don't know how to find the format for different countries.

1.Is there any way to find the address format based on country/country codes?

2.Is there a way we can get the fully formatted address using a single function, like we use ABRecordCopyCompositeName() to get the full name?

Answer

Try this link ABCreateStringWithAddressDictionary

It looks like you need to use: ABCreateStringWithAddressDictionary that will return:

Returns a formatted address from an address property. (From Apple)

Good luck

Comments