Re: AddressBook - ABMultiValue
Re: AddressBook - ABMultiValue
- Subject: Re: AddressBook - ABMultiValue
- From: email@hidden
- Date: Tue, 27 Aug 2002 16:12:01 -0700
The problem here is the use of indexForIndentifier. The identifiers in
an ABMultiValue are unique keys, they are not mappable to a lable like
kABPhoneMainLabel (i.e., you could have multiple Main phone numbers for
someone). If you specifically want to get the phone number with a Main
label, you'll have to iterate through the values checking labelAtIndex.
If you just want the primary phone number, you can ask for [myValues
valueAtIndex:[myValues indexForIdentifier:[myValues
primaryIdentifier]]] ... not the most intuitive approach, but it works.
- Eric Hanson
Incarna LLC
On Monday, August 26, 2002, at 11:08 PM, Ben Mackin wrote:
I have been working on adding Address Book support (10.2) to my app and
everything is going great, except for one thing. I have been reading
about
this whole ABMultiValue thing, and thought I had gotten it. But when I
try
and use the following code:
ABMultiValue *myValues;
int myIndex;
myValues = [[peopleFound objectAtIndex:0]
valueForProperty:kABPhoneProperty];
myIndex = [myValues indexForIdentifier:kABPhoneMainLabel];
string = [myValues valueAtIndex: myIndex];
I get an error that:
-[NSCFArray objectAtIndex:]: index (2147483647) beyond bounds (2)
So when I am supposed to supply an identifier, is it not supposed to
be one
from ABGlobals.h? I know there is a value in the address book for
kABPhoneMainLabel, and another in the phone tree (the fax number) so I
think
something should be returned.
I have read through the manual (page) on this, and from my
understanding
this should work, right?
Thanks,
Ben
_______________________________________________
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.
_______________________________________________
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.