简体   繁体   English

如何检测联系人是iOS应用程序地址簿中的组织而不是人?

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

In iOS devices, the contacts application doesn't support to create/maintain a contact as an organization. 在iOS设备中,联系人应用程序不支持创建/维护组织中的联系人。 However, it is supported in contacts application of MAC OS. 但是,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. 从MAC OS创建并同步到iOS设备的联系人将在iOS设备的联系人应用程序中显示组织的不同默认图像。

So I am looking for the solution to detect a contact as an organization for iOS development. 所以我正在寻找一种解决方案来检测联系人作为iOS开发的组织。

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. 这些常量实现了person类型属性(类型为kABIntegerPropertyType的属性),它指示人员记录是代表人类还是组织。

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 你可以在这里阅读: http//developer.apple.com/library/ios/#documentation/AddressBook/Reference/ABPersonRef_iPhoneOS/Reference/reference.html

shani 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);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM