Tuesday, April 8, 2014

Handling AddressBook in iphone [ iOS ]


ABAddressBookRef is class in iOS used to access the address book (a centralized database used by multiple application). with this class we can add, modify, delete the contact.

Create new address book object  from address book database.:-

ABAddressBookRef pAddressBook = ABAddressBookCreateWithOptions(NULL, &error);

Each record in the Address Book database hase a unique ID , which you can retrive by ABRecordGetRecordID function.

 ABRecordRef class holds one record inside.
You can access records as follows

ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, &error);
CFArrayRef allSources = ABAddressBookCopyArrayOfAllSources(addressBook);

for (CFIndex i = 0; i < CFArrayGetCount(allSources); i++) 

        {
ABRecordRef source = (ABRecordRef)CFArrayGetValueAtIndex(allSources, i);
      }

0 comments:

Post a Comment

About

Powered by Blogger.