What are the Tags Around Default iPhone Address Book People Phone Number Labels?
Posted
by rnistuk
on Stack Overflow
See other posts from Stack Overflow
or by rnistuk
Published on 2010-03-08T21:41:37Z
Indexed on
2010/03/14
1:15 UTC
Read the original article
Hit count: 413
My question concerns markup that surrounds some of the default phone number labels in the Person entries of the Contact list on the iPhone.
I have created an iPhone contact list address book entry for a person, "John Smith" with the following phone number entries:
- Mobile (604) 123-4567
- iPhone (778) 123-4567
- Home (604) 789-4561
- Work (604) 456-7891
- Main (604) 789-1234
- megaphone (234) 567-8990
Note that the first five labels are default labels provided by the Contacts application and the last label, "megaphone", is a custom label.
I wrote the following method to retrieve and display the labels and phone numbers for each person in the address book:
-(void)displayPhoneNumbersForAddressBook {
ABAddressBookRef book = ABAddressBookCreate();
CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(book);
ABRecordRef record = CFArrayGetValueAtIndex(people, 0);
ABMultiValueRef multi = ABRecordCopyValue(record, kABPersonPhoneProperty);
NSLog(@"---------" );
NSLog(@"displayPhoneNumbersForAddressBook" );
CFStringRef label, phone;
for (CFIndex i = 0; i < ABMultiValueGetCount(multi); ++i) {
label = ABMultiValueCopyLabelAtIndex(multi, i);
phone = ABMultiValueCopyValueAtIndex(multi, i);
NSLog(@"label: \"%@\" number: \"%@\"", (NSString*)label, (NSString*)phone);
CFRelease(label);
CFRelease(phone);
}
NSLog(@"---------" );
CFRelease(multi);
CFRelease(people);
CFRelease(book);
}
and here is the output for the address book entry that I entered:
2010-03-08 13:24:28.789 test2m[2479:207] ---------
2010-03-08 13:24:28.789 test2m[2479:207] displayPhoneNumbersForAddressBook
2010-03-08 13:24:28.790 test2m[2479:207] label: "_$!<Mobile>!$_" number: "(604) 123-4567"
2010-03-08 13:24:28.790 test2m[2479:207] label: "iPhone" number: "(778) 123-4567"
2010-03-08 13:24:28.791 test2m[2479:207] label: "_$!<Home>!$_" number: "(604) 789-4561"
2010-03-08 13:24:28.791 test2m[2479:207] label: "_$!<Work>!$_" number: "(604) 456-7891"
2010-03-08 13:24:28.792 test2m[2479:207] label: "_$!<Main>!$_" number: "(604) 789-1234"
2010-03-08 13:24:28.792 test2m[2479:207] label: "megaphone" number: "(234) 567-8990"
2010-03-08 13:24:28.793 test2m[2479:207] ---------
What are the markup characters
_$!< and >!$_
surrounding most, save for iPhone, of the default labels for?
Can you point me to where in the "Address Book Programming Guide for iPhone OS" I can find the information?
Thank you for your help.
© Stack Overflow or respective owner