• 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
Re: AddressBook, ABMultiValue, and indexForIdentifier
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >AddressBook, ABMultiValue, and indexForIdentifier (From: "Terence G4 Mac" <email@hidden>)

  • Prev by Date: Re: CFBundleGetInfoString Question
  • Next by Date: Paginating an NSTableView
  • Previous by thread: AddressBook, ABMultiValue, and indexForIdentifier
  • Next by thread: Re: AddressBook, ABMultiValue, and indexForIdentifier
  • Index(es):
    • Date
    • Thread