Reputation: 6386
Currenty I want to load iphone's addressbook db into my iphone app db..i mean i want to dump addressbook data into my app db
Is it possible? if so give me a link or references to do so
Thanks for any help
Cant i export AddressBook.sqlitedb to another sqlite db for my iphone app?
I mean, do i need to iterate over the loop?
Isn't possible to load the addressbook.db data into my database in which i am going to create my own addressbook ...
Upvotes: 1
Views: 840
Reputation: 2649
This link may be useful to you.Thanks. EDIT : You need to search in some google links as well as the related posts on the same page. It would give you other ways around. Also as per your comment, you first of all need to fetch the data from the address book from any of the methods given in these different answers and store in NSDictionary or array and afterwards you can store it into your local database or web server using the supported methods. Hope this helps you.
Upvotes: 0
Reputation: 11213
There is another Stackoverflow question which I posted a while ago that has some good answers that may be of some use to you.
However to answer your specific question as to whether you can export AddressBook.sqlitedb to your app, I think the answer is probably no. You can achieve it via the AB Wrapper,but not by direct copying.
Upvotes: 0
Reputation: 19869
Yes it os possible.
Look here:
It would like like that:
ABAddressBookRef addressBook = ABAddressBookCreate( );
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople( addressBook );
CFIndex numberOfAllPeople = ABAddressBookGetPersonCount( addressBook );
for ( int i = 0; i < numberOfAllPeople; i++ )
{
ABRecordRef ref = CFArrayGetValueAtIndex( numberOfAllPeople, i );
//use the ref to store its properties in your db
}
Upvotes: 1
Reputation: 9126
This should have everything you need to get started:
The APIs are not meant to be used to dump the address book though - developers are supposed to interact with the centralized database in a courteous manner.
I recommend a full backup of your contact database before you start debugging ;)
Upvotes: 0