Create an empty ABAddressBook in iPhone SDK?
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.
精彩评论