• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Address Book: updating a person's phone number info...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Address Book: updating a person's phone number info...


  • Subject: Address Book: updating a person's phone number info...
  • From: "Lee, Frederick" <email@hidden>
  • Date: Mon, 18 Aug 2008 11:54:40 -0400
  • Thread-topic: Address Book: updating a person's phone number info...

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 (email@hidden)

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:

This email sent to email@hidden

  • Prev by Date: NSString Question
  • Next by Date: Re: Right place to unobserve notifications in a document
  • Previous by thread: Re: NSString Question
  • Next by thread: Audio Queue Services example?
  • Index(es):
    • Date
    • Thread