Skip to content

Instantly share code, notes, and snippets.

@sthorne
Created February 20, 2015 17:06
Show Gist options
  • Save sthorne/71b272b35e55dceb3ac6 to your computer and use it in GitHub Desktop.
Save sthorne/71b272b35e55dceb3ac6 to your computer and use it in GitHub Desktop.
Copy iOS AddressBook into NSArray
CFErrorRef error = NULL;
ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(nil, &error);
if (error != NULL) {
NSLog(@"Error reading AddressBook: %@", error);
}
CFArrayRef contacts = ABAddressBookCopyArrayOfAllPeople(addressBook);
NSArray contactArray = CFBridgingRelease(contacts);
NSLog(@"%@", contactArray);
CFRelease(addressBook);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment