以编程方式链接CNContacts [英] Programmatically Link CNContacts
问题描述
在我的应用中,我想创建一个新的联系人。如果已经存在具有相同名称的联系人,我想将新联系人链接到旧联系人。
In my app, I want to create a new contact. If a contact with the same name already exists, I want to link the new contact to the old one.
我查看了CNContact和CNContactStore引用,但没有看到任何链接联系人的方法。这是可能的,如果是这样,怎么办?
I have looked into the CNContact and CNContactStore references, and don't see any way to link contacts. Is this possible, and if so, how?
推荐答案
在IOS9中,代表同一个人的不同帐户中的联系人可能会自动链接一起。
In IOS9 contacts in different accounts that represent the same person may be automatically linked together.
要实现这一目标,您应该确保新插入的联系人的姓名与您想要统一的联系人姓名一致。
To achieve this you should make sure that the name of your newly inserted contact matches the name of the contact you would like to unify with.
下面链接的文档给出了iCloud和Facebook上John Appleseed的例子。
The documentation linked below gives the example of "John Appleseed" on iCloud and Facebook.
这篇关于以编程方式链接CNContacts的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!