Re: Enumerating Address Book properties
Re: Enumerating Address Book properties
- Subject: Re: Enumerating Address Book properties
- From: Henri Lamiraux <email@hidden>
- Date: Sat, 22 Feb 2003 15:23:43 -0800
+properties returns ALL properties defined on a given object (ABPerson
or ABGroup). Either built-in or custom properties.
As far as getting which values have been really set on a given instance
of ABPerson or ABGroup you need to call -valueForProperty: for each
property.
The phonetic version of first middle and last name is mainly for the
Japanese market. Kanji alone is not enough to figure out the
pronunciation. A phonetic version is necessary. The phonetic version is
also used for sorting.
Henri-
On Saturday, February 22, 2003, at 01:44 PM, Denis Stanton wrote:
Hi Tito
Thanks for your help. You have neatly described the fall back plan I
was going to have to use if I can't find a way to read the actual
properties defined for an Address Book record. As +(NSArray
*)properties; is a class method it returns a list of all properties
defined in the whole Address Book file rather than those used by a
specific record (or have I misunderstood this?). Unfortunately there
are 35 standard properties defined in ABGlobals, so to be sure of
finding all the properties for a person I will have to ask each person
35 times "Have you got a value for property X?". This is a bit
wasteful as most Person entries will have only four or five
properties, In practice I can probably ignore some of the properties
(who cares what the phonetic form of a person's middle initial is?).
This still leaves me with a problem regarding custom properties.
Inside Mac OS X tells me that programs can define entirely new
properties. These won't be defined in ABGlobals, and I assume
+(NSArray *)properties; won't return them, so how will I know what to
ask for in valueForProperty:(NSString *)property ? Of course if my
program adds new properties (this is an important part of the
application I'm writing) I can keep track of them somewhere, but this
won't allow me to 'discover' properties inserted by other Address Book
users.
Am I right in thinking that + (NSArray *)properties; won't tell me
about any non-standard properties
Thank you for taking the time to help me out here. I'm sorry to come
back with such a long question.
Denis Stanton
On Saturday, February 22, 2003, at 09:24 PM, Tito Ciuro wrote:
Hello,
On Saturday, February 22, 2003, at 08:32 AM, Denis Stanton wrote:
Can anyone tell me if there is a way to obtain the properties of an
Address Book entry? Address Books contain People and Group records
where ABPeople and ABGroup are each subclasses of ABRecord.
ABRecords
have properties, like First Name or Telephone Number.
I want to get a list of all the properties that a given person has
values for.
You can retrieve *all* properties for a person with:
+ (NSArray *)properties;
Then, you can obtain the value for each property with ABRecord's:
- (id)valueForProperty:(NSString *)property
If the value isn't set, nil will be returned. Just keep the non-nil
values and you're set.
-- Tito
_______________________________________________
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.
Denis Stanton
email@hidden
Home: +64 9 533 0391
mobile: +64 21 1433622
_______________________________________________
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.