开发者

How to detect a contact is an organization instead of person in address book of iOS application?

开发者 https://www.devze.com 2023-02-06 05:16 出处:网络
In iOS devices, the contacts application doesn\'t support to create/maintain a contact as an organization. However, it is supported in contacts application of MAC OS. The contact created from MAC OS a

In iOS devices, the contacts application doesn't support to create/maintain a contact as an organization. However, it is supported in contacts application of MAC OS. The contact created from MAC OS and synchronized to iOS devices will show different default image for an organization in the contacts application of iOS devices.

So I am looking for the solution to detect a contact as an organization for iOS development.

Please help if you have the solution or开发者_高级运维 any comment.


you can use this

These constants implement the person type property (a property of type kABIntegerPropertyType), which indicates whether a person record represents a human being or an organization.

const ABPropertyID kABPersonKindProperty;
const CFNumberRef kABPersonKindPerson;
const CFNumberRef kABPersonKindOrganization;

you can read about it here: http://developer.apple.com/library/ios/#documentation/AddressBook/Reference/ABPersonRef_iPhoneOS/Reference/reference.html

shani


You can find out whether a contact belongs to an organization or to an individual like this:

ABRecordRef contact = // ... The contact you want to check.
CFNumberRef contactKind = ABRecordCopyValue(contact, kABPersonKindProperty);

if (contactKind == kABPersonKindOrganization) {
    // The contact belongs to an organization.
}

if (contactKind) {
    CFRelease(contactKind);
}
0

精彩评论

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

关注公众号