Re: AddressBook, ABMultiValue, and indexForIdentifier
Re: AddressBook, ABMultiValue, and indexForIdentifier
- Subject: Re: AddressBook, ABMultiValue, and indexForIdentifier
- From: Vince DeMarco <email@hidden>
- Date: Tue, 26 Nov 2002 21:47:48 -0800
On Tuesday, November 26, 2002, at 06:00 PM, Terence G4 Mac wrote:
Hi all,
I'm experiencing some wierdness with the Address Book's
indexForIdentifier on ABMultiValue fields.
Specifically, there are cases where a contact entry clearly has, for
example, a home phone. Yet, when I query the ABMultiValue field for
the indexForIdentifier for the kABPhoneHomeLabel, I won't get a valid
result.
Or, with code...
//...
ABMutableMultiValue *phone;
phone = [[person valueForProperty:kABPhoneProperty] mutableCopy];
if ([phone count] > 1)
{
i = [phone indexForIdentifier:kABPhoneHomeLabel];
if ((i > 0) && (i < 12))
[self setHome_phone1: [phone valueAtIndex:i]]; //never gets
here
//....
}
Because you are doing it wrong.
1) why are you making a mutable copy of the phone returned with
valueForProperty:??
2) try valueAtIndex: instead of indexForIdentifier:
The net result being that I never get a home phone value back, even if
there's one to get...
So, can anyone spot what I'm doing wrong? Is it the fact that I access
the mutableCopy instead of the valueForProperty directly?
Any thoughts would be greatly appreciated :)
Thanks!!
Terence
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
_______________________________________________
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.