Re: Enumerating Address Book properties
Re: Enumerating Address Book properties
- Subject: Re: Enumerating Address Book properties
- From: Denis Stanton <email@hidden>
- Date: Sun, 23 Feb 2003 10:44:51 +1300
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.