如何在“本地”联系人中创建联系人地址簿? [英] How to create a contact in the "local" addressbook?

查看:128
本文介绍了如何在“本地”联系人中创建联系人地址簿?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以编程方式在本地地址簿中创建联系人(以便它不会尝试同步,这会导致与Exchange的某些兼容性问题)。

I am wanting to create a contact programmatically into the "local" addressbook (so that it doesn't try to synch, which causes some compatibility issues with Exchange).

如果本地地址簿已经存在,则可以使用ABAddressBookCopyArrayOfAllSources找到它,以获取地址簿中的所有源,然后查找sourceTypeRef为 kABSourceTypeLocal的ABRecordRef-如果将该recordRef传递给ABPersonCreateInSource,则可以添加记录到本地目录。

If a local addressbook already exists, I can find it using ABAddressBookCopyArrayOfAllSources to get all the sources in the Address Book, then look for the ABRecordRef with a sourceTypeRef of "kABSourceTypeLocal"- if I then pass that recordRef to ABPersonCreateInSource, I can add a record to the local directory.

如果有IS N'T,没有人对我最好如何在本地地址簿中创建记录有任何建议。

Does anyone have any suggestions as to how I should best go about creating a record in the "local addressBook", if there ISN'T a local addressbook already?

(此外,由于上述调用不可用,我该如何在iOS4之前进行此操作?)

(also, how could I do this pre-iOS4, as the above calls weren't available then?)

谢谢

Peter

推荐答案

您应该看一下这篇文章:
在iOS 4+中从ABAddressBook获取特定的ABSource

You should take a look at this post: Obtaining Specific ABSource from ABAddressBook in iOS 4+

演示了如何识别和定位特定的ABSource(ABSource) ABAddressBook。虽然这段代码提到了函数ABGroupCreateInSource(),但还有一个类似的函数ABPersonCreateInSource()用于与人打交道。

that demonstrates how to identify and target specific sources (ABSource) within the ABAddressBook. While this code mentions the function, ABGroupCreateInSource(), there is a similar function, ABPersonCreateInSource() for working with persons.

这篇关于如何在“本地”联系人中创建联系人地址簿?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆