Search code examples
iosmacosaddressbook

how to get localized label names on OS X Addressbook?


I'm working with the addressbook framework both in iOS and OS X, now on iOS I used something like this:

CFStringRef phoneNumberLocalizedLabel = ABAddressBookCopyLocalizedLabel( phoneNumberLabel );

however on OS X i'm using this:

NSString *emailType = [emails labelAtIndex:i];

And I can't seem to find a way to get the localized string, any ideas how can I achieve this?


Solution

  • Seems I didn't read the documentation thoroughly enough, anyways you can use either ABLocalizedPropertyOrLabel and ABCopyLocalizedPropertyOrLabel methods, ex:

    NSString *locLabel1 = ABLocalizedPropertyOrLabel([phoneNumbers labelAtIndex:i]);