开发者

Create an empty ABAddressBook in iPhone SDK?

开发者 https://www.devze.com 2022-12-17 06:46 出处:网络
Can I create an ABAddressBook which does not read data from my address book. i.e. it\'s empty to start with so that I can put in my own contacts fetched from the internet.

Can I create an ABAddressBook which does not read data from my address book. i.e. it's empty to start with so that I can put in my own contacts fetched from the internet.

As you may know the function

ABAddressBookRef ab = ABAddressBookCreate(); 

gives me data from the built in addressbook. This is not what I want but if y开发者_JAVA技巧ou know a solution to my problem please let me know.


I don't think it is possible to have an empty instance of ABAddressBook. The documentation is only about getting an ABAddressBook filled with the address book of the iPhone.


You could try making an array (or mutablearray) that you fill with the contacts and put the array inside a UITableView.


I've been working on a "private contacts" app which stores contacts off of the normal address book and I can confirm that this is indeed possible, if only through a little manipulation. Using the ABAddressBookRef variable, however, won't help you at all. What you need is a NSMutableArray of ABRecordRef's, which is how iOS stores its contacts.


You could try to zero out ABAddressBookRef with a memset/calloc and see if that gives you the desired result.

0

精彩评论

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