I am testing with iOS AddressBook framework and I am trying to figure what, what's the best way to extract the value at specific label and wondering at the same time if the order of these labels change, for any random reason.
This is what I am doing when I am adding a new contact or adding to an existing one:
let phone:ABMutableMultiValue = ABMultiValueCreateMutable(
ABPropertyType(kABStringPropertyType)).takeRetainedValue()
ABMultiValueAddValueAndLabel(phone, phoneNumber, kABPersonPhoneMainLabel, nil)
And later on in the delegate call to unknownPersonViewController()
I am doing this:
let phone: ABMultiValueRef = ABRecordCopyValue(person,
kABPersonPhoneProperty).takeRetainedValue()
firstPhone = ABMultiValueCopyValueAtIndex(phone, 0).takeRetainedValue() as! String
Notice that I am assuming that the main label is at index 0. I know that a comparison with CFString label is possible, but these labels look funny, giving me this weird gut feeling when comparing agains them. So, I am not really sure how to go about this.