Reputation: 2686
how can i add a website to the contacts of the iphone/ipad address book? I managed to add email, phone numbers, but i cannot did the same with a site. Presently, i'm using this code to have the site written in the address book and displayed, but clicking on it i get displayed the form to write an email
const CFStringRef siteLabel = CFSTR("Site");
ABMutableMultiValueRef multiEmail = ABMultiValueCreateMutable(kABMultiStringPropertyType);
ABMultiValueAddValueAndLabel(multiEmail, sito, siteLabel, NULL);
ABRecordSetValue(newPerson, kABPersonEmailProperty, multiEmail, &error);
CFRelease(multiEmail);
Upvotes: 1
Views: 821
Reputation: 19789
You need to use the kABPersonSocialProfileProperty
property and kABPersonSocialProfileURLKey
key.
e.g.:
ABMutableMultiValueRef multiURL = ABMultiValueCreateMutable(kABPersonSocialProfileProperty);
ABMultiValueAddValueAndLabel(multiURL, url, siteLabel, NULL);
ABRecordSetValue(newPerson, kABPersonSocialProfileURLKey, multiURL, &error);
Upvotes: 3
Reputation: 2686
Solved using the code by Paul, modified a little!
ABMutableMultiValueRef multiURL = ABMultiValueCreateMutable(kABMultiStringPropertyType);
ABMultiValueAddValueAndLabel(multiURL, url, siteLabel, NULL);
ABRecordSetValue(newPerson, kABPersonURLProperty, multiURL,&error);
CFRelease(multiURL);
Upvotes: 1