Posted by: bearc0025 | May 5, 2009

Adding phonenumbers to ABPerson

Adding phonenumbers to ABPerson

Also, email addresses are similar…


// Where email is the string and kABOtherLabel cd also be kABHomeLabel or kABWorkLabel.
ABMutableMultiValueRef emailMultiValue = ABMultiValueCreateMutable(kABPersonEmailProperty);
ABMultiValueAddValueAndLabel(emailMultiValue, email, kABOtherLabel, NULL);
ABRecordSetValue(person, kABPersonEmailProperty, emailMultiValue, nil);

Update: Here’s code to fetch phone numbers…

ABMutableMultiValueRef phoneNumberMultiValue =  ABRecordCopyValue(record, kABPersonPhoneProperty);  
for (CFIndex i = 0; i < ABMultiValueGetCount(phoneNumberMultiValue); i++) { CFStringRef label = ABMultiValueCopyLabelAtIndex(phoneNumberMultiValue, i); CFStringRef phoneNum = ABMultiValueCopyValueAtIndex(phoneNumberMultiValue, i); } [/sourcecode]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: