Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extract 'is a company' from ABPersonRecord

My iOS app is showing the contents of a user's address book with some app-specific UI elements. One challenge that I'm unable to figure out, is where in the AddressBook framework it's stored whether a person is marked 'as a company', or not. Here's a screenshot of the checkbox in the Mac address book app (sorry for the Dutch in there, 'Bedrijf' means 'Company').

Screenshot of the OSX Address Book app, 'Bedrijf' means 'Company' Screenshot of the OSX Address Book app, company checkbox is off

You can't edit this property on an iOS device, but it syncs over if you use iCloud or some other sync service. As you see, it influences whether the first-name/last-name or the company name should be used to display this contact and it changes the placeholder icon.

I'm iterating over the contents of ABAddressBookCopyArrayOfAllPeople(addressBook); and extract the info I need from the ABRecordRef instances. I'm using the 'Personal Information Properties' constants listed in the reference guide, but I just can't find the constant to get at the flag whether a person is marked as a company or a person.

I'm looking for a flag with something of 'company' or 'organization' in there, but I'm obviously looking in the wrong place. Who can point me in the right direction?

like image 317
epologee Avatar asked Nov 18 '25 04:11

epologee


1 Answers

You've almost found it: Person Type Property kABPersonKindProperty property has values of kABPersonKindPerson or kABPersonKindOrganization

like image 131
Denis Avatar answered Nov 20 '25 22:11

Denis