Easy access to iOS address book
Objective-C C Ruby
Switch branches/tags
Nothing to show
Pull request Compare This branch is 251 commits behind Alterplay:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


APAddressBook is a wrapper on AddressBook.framework that gives easy access to native address book without pain in a head.


  • Load contacts from iOS address book asynchronously
  • Decide what contact data fields you need to load (for example, only first name and phone number)
  • Filter contacts to get only necessary records (for example, you need only contacts with email)
  • Sort contacts with array of any NSSortDescriptor


Add APAddressBook pod to Podfile


Load contacts
APAddressBook *addressBook = [[APAddressBook alloc] init];
// don't forget to show some activity
[addressBook loadContacts:^(NSArray *contacts, NSError *error)
    // hide activity
    if (!error)
        // do something with contacts array
        // show error


Callback block will be run in main thread!

Select contact fields bit-mask

Available fields:

  • APContactFieldFirstName - contact first name
  • APContactFieldLastName - contact last name
  • APContactFieldCompany - contact company (organisation)
  • APContactFieldPhones - contact phones array
  • APContactFieldEmails - contact emails array
  • APContactFieldPhoto - contact photo
  • APContactFieldThumbnail - contact thumbnail
  • APContactFieldDefault - contact first name, last name and phones array
  • APContactFieldAll - all contact fields described above


You should use APContactFieldPhoto very carefully, because it takes a lot of memory and may crash the application. Using APContactFieldThumbnail is much safer.

Example of loading contact with first name and photo:

APAddressBook *addressBook = [[APAddressBook alloc] init];
addressBook.fieldsMask = APContactFieldFirstName | APContactFieldPhoto;
Filter contacts

The most common use of this option is to filter contacts without phone number. Example:

addressBook.filterBlock = ^BOOL(APContact *contact)
    return contact.phones.count > 0;
Sort contacts

APAddressBook returns unsorted contacts. So, most of users would like to sort contacts by first name and last name.

addressBook.sortDescriptors = @[
    [NSSortDescriptor sortDescriptorWithKey:@"firstName" ascending:YES],
    [NSSortDescriptor sortDescriptorWithKey:@"lastName" ascending:YES]
Check address book access
switch([APAddressBook access])
    case APAddressBookAccessUnknown:
        // Application didn't request address book access yet

    case APAddressBookAccessGranted:
        // Access granted

    case APAddressBookAccessDenied:
        // Access denied or restricted by privacy settings

githalytics.com alpha If you have improvements or concerns, feel free to post an issue and write details.


Check out all Alterplay's GitHub projects. Email us with other ideas and projects.


Version 0.0.3

Version 0.0.2

  • Fixed potential crash on fetching contacts using non-property APAddressBook object. Thanks to Evgen Bakumenko.

Version 0.0.1

  • First release.