Skip navigation.
 
mlRe: AddressBook & phone multivalue
FROM : Steve Sheets
DATE : Sat Nov 09 22:02:24 2002

Terence,

    That should be the correct call you are using. Be careful,
valueForProperty returns a immutable value, not a mutable one! Are you
sure you have the correct Person? This is the code I been using lately.
Given an ABPerson (a_ab_person) & an NSMutableString (a_output_str),
the following code lists each phone (label: number) for the given
person into the output string:

   int a_int;
   int a_count;
   NSString* a_str;
   ABMultiValue* a_multi;

        [a_output_str setString:@""];
        a_multi = [a_ab_person valueForProperty:kABPhoneProperty];
       if (a_multi) {
       a_int = [a_multi count];
       if (a_int>0) {
       for (a_count=0; a_count<a_int; a_count++) {
           a_str = [a_multi labelAtIndex:a_count];

                   [a_output_str
appendString:ABLocalizedPropertyOrLabel(a_property_str)];
                   [a_output_str appendString:@": "];

           a_str = [a_multi valueAtIndex:a_count];

                   [a_output_str appendString: a_str];
                   [a_output_str appendString:@"\n"];
                }
   }

Hope this helps!


Steve Sheets

ps. Be on the look out for a new shareware Address Book print utility
from my company!

----------------------

On Saturday, November 9, 2002, at 01:00  AM,
<email_removed> wrote:

> Message: 3
> From: "T G" <<email_removed>>
> To: <email_removed>
> Subject: AddressBook & phone multivalue
> Date: Fri, 08 Nov 2002 21:46:27 +0000
>
> Hi all,
>
> I'm having trouble with phone numbers & the AddressBook. Specifically,
> when
> I try to retreive the phone numbers for a given person, I get no data,
> regardless of the fact that the contact in question definitely has at
> least
> one phone number.
>
> Here's how I'm doing it...  (where person is of type ABPerson *)
>
> ABMutableMultiValue *phone;
> //...
> phone = [person valueForProperty:kABPhoneProperty];
> //...
>
> phone is always nil. :(
>
> Has anyone else encountered this? Or is it just something really basic
> that
> I've managed to overlook?
>
> Thanks,
>
> Terence

_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlAddressBook & phone multivalue T G Nov 8, 22:46
mlRe: AddressBook & phone multivalue Barry Books Nov 9, 15:13
mlRe: AddressBook & phone multivalue Henri Lamiraux Nov 9, 16:36
mlRe: AddressBook & phone multivalue Alec Carlson Nov 9, 20:55
mlRe: AddressBook & phone multivalue Steve Sheets Nov 9, 22:02
mlRe: AddressBook & phone multivalue Sheehan Olver Nov 9, 22:03