It would be nice to see where and from what type you define vars. You may also have issued an address book before these lines. (e.g. CFRelease(multiPhone); ) And as far as I know, phoneNum and emailID should be ABMutableMultiValueRef . At least that's what I did:
Adding a single phone number
ABMutableMultiValueRef multiPhone = ABMultiValueCreateMutable(kABMultiStringPropertyType); ABMultiValueAddValueAndLabel(multiPhone, [self.contact telephone], kABPersonPhoneMobileLabel, NULL); ABRecordSetValue(person, kABPersonPhoneProperty, multiPhone,nil);
Adding an Email:
ABMutableMultiValueRef multiEmail = ABMultiValueCreateMutable(kABMultiStringPropertyType); ABMultiValueAddValueAndLabel(multiEmail, @" abc@abc.com ", kABWorkLabel, NULL); ABRecordSetValue(person, kABPersonEmailProperty, multiEmail, &error); CFRelease(multiEmail);
Additional Information on the Address Book Tutorial
Hope this helps.
source share