Re: AddressBook & phone multivalue
Re: AddressBook & phone multivalue
- Subject: Re: AddressBook & phone multivalue
- From: Steve Sheets <email@hidden>
- Date: Sat, 9 Nov 2002 16:02:24 -0500
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@hidden wrote:
>
Message: 3
>
From: "T G" <email@hidden>
>
To: email@hidden
>
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@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.