1

II trying to change the value of ABPerson / ABMultiValue (the phone numbers).

Anyway to update these?

ABAddressBook *ab = [ABAddressBook sharedAddressBook];  
NSArray *persons = [ab people];

int j=[persons count];

for (int i=0; i<j; i++) {
    ABPerson *person = [persons objectAtIndex:i];               
    ABMultiValue *phonenumbers = [person valueForProperty:kABPhoneProperty];
    //  update here *phonenumbers
}

Thanks!

Roger
  • 7,535
  • 5
  • 41
  • 63

1 Answers1

2

Try calling:

ABMultiValueRef phoneNumbers = ABMultiValueCreateMutable(kABPersonPhoneProperty);
ABMultiValueAddValueAndLabel(phoneNumbers, value, label, null);
ABRecordSetValue(person, kABPersonPhoneProperty, phoneNumbers, NULL);

Add one of these: ABMultiValueAddValueAndLabel(phoneNumbers, value, label, null) for every value you want to add.

eeerahul
  • 1,629
  • 4
  • 27
  • 38
Chuck
  • 36
  • 2
  • Instead of `ABMultiValueCreateMutable(kABPersonPhoneProperty)`, use `ABMultiValueCreateMutable(kABMultiStringPropertyType)`, otherwise you'll get "Can't return type callbacks for 3" printed on the console (and presumably bad things happening later). [source](http://iphonedevsdk.com/forum/iphone-sdk-development/23289-abnewpersonviewcontroller-crashes-when-scrolling.html) – Manav Jul 01 '14 at 12:22