0

How do I add city/state and country to an existing contact in the address book?

I haven't worked with address book until now. The app is supposed to run through the entire address book and if there is no address there will be an option to add it without opening the address book app.

Here is what I tried to do until now:

ABRecordRef contact = NULL;
ABMultiValueRef multiPhone = ABMultiValueCreateMutable(kABPersonAddressProperty);
ABMultiValueAddValueAndLabel(multiPhone, (__bridge_retained CFStringRef)city,
     kABPersonAddressCityKey, NULL);
ABMultiValueAddValueAndLabel(multiPhone, (__bridge_retained CFStringRef)state,
     kABPersonAddressStateKey, NULL);
ABMultiValueAddValueAndLabel(multiPhone, (__bridge_retained CFStringRef)country,
     kABPersonAddressCountryKey, NULL);

ABRecordSetValue(contact, kABPersonAddressProperty, multiPhone, nil);
CFRelease(multiPhone);
rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • What's the problem? You stated what you want to do. You posted some code. But you neglected to mention what the problem with the code is. – rmaddy Mar 17 '14 at 22:01
  • Just as @rmaddy said, what is the problem? The only thing I can think of is that you do not know how to edit an already existing contact. – erdekhayser Mar 18 '14 at 00:16
  • first of all yes i dont know how to edit an existing contact and after two days of searching for solution i came up with this code and still i get nothing. the result of this thing is nothing and i don't know if i'm close to the solution or not. thanks for replying. – user3430707 Mar 18 '14 at 05:48

0 Answers0