Environment: Xcode 3.1

OS: Leopard (10.5.4+)

Generic Environment: MacBook Pro & <NDA devices>

 

Greetings:

     I'm partially clear about access/updating the Address Book using
the C interfaces.  

However, I'm slamming into the wall with confusion on updating a 

multi-value item like a phone number.

 

Overview: 1) check if person has a particular phone label (e.g.,
'mobile');

2) if so, modify it or create it.

 

This is what I essentially know:

 

1) Create a local copy of Address Book, with its members already there: 

    ABAddressBookRef addressBook = ABAddressBookCreate(); 

 

2) Get the target person's record (I've stored the person's "Unique
ID"):

   ABRecordRef thePerson = 

         ABAddressBookGetPersonWithRecordID (addressBook, 

             (NSInteger)[gSelectedMemberDict objectForKey:@"uniqueID"]);

 

 

3) Extract the person's multi-value property (which are not mutable,
need a copy):

  a) Copy the value of the particular property (in this case,
multi-string property?):

ABRecRef abRecRef = < get the Record Reference via its unique id >

ABMutableMultiValueRef phoneNumberMultiValue = ABRecordCopyValue(
abRecordRef, kABPersonPhoneProperty); 

 

--- if found, use it ----

 

phoneNumberMultValue for loop {

--- don't know count syntax here ---

}

 

--- if not found, create it ----

 

    ABMutableMultiValueRef phoneNumberMultiValue = 

             ABMultiValueCreateMutable(kABPersonPhoneProperty);   

    ABMultiValueAddValueAndLabel(phoneNumberMultiValue, @"(555)
123-4567", 

             kABPersonPhoneMobileLabel, NULL);

    

 

4) Now I need to attach this property to the person Record (I'm lost
here):

 

    bool ABRecordSetValue (thePerson, phoneNumberMultiValue

                           ABRecordRef record, 

                           ABPropertyID property,  <<-- how do I get
this?

                           CFTypeRef value, 

                           CFErrorRef *error 

    ); 

    

 

5) Once I got the person record updated,  insert it back into address
Book...

I don't see an API that actually INSERTS a person's record into the
address book....

 

So do I just do an AddressBook Save?

 

ABAddressBookSave(addressBook, error); 

 

 

I've slammed into the wall here, confused.

 

Much obliged to help...

Ric.

 

 

 

 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to