tags:

views:

23

answers:

2

I would like to use iPhone's Contact address book or ABAddressBookRef to pick up a company, edit a company or create a new company. For editing/creating, I would like to show only fields of name, address1, address2, city and state.

I tried to google information about this. What I found are some related constants or strucs, such as:

kABShowAsCompany
kABPersonOrganizationProperty
ABSearchElement

Not sure how those are related to my case and how to use them. Are any examples or codes available as reference?

A: 

Quick Contacts has some good example code.

Gorgando
A: 

ABAddressBook is a C API. If you want to code against a nice Objective-C API, use Google Toolbox for Mac: http://code.google.com/p/google-toolbox-for-mac (it's actually for iPhone, too!)

Using GTM, you access the attributes like this:

GTMABPerson* person;
[person setValue:@"Company Name" forProperty:kABPersonOrganizationProperty];
[person setValue:(NSNumber*)kABPersonKindOrganization forProperty:kABPersonKindProperty];
Ortwin Gentz