开发者

How to use ABAddressBookRef for companies instead of persons?

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 lik开发者_如何学Pythone 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?


Quick Contacts has some good example code.


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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜