I suspect that your problem is related to the difference between 64-bit and 32-bit architectures, Xcode 5.1 supports the default 64-bit support. If pointers have 64 bits and int has 32 bits, int is too small to hold the value of the pointer.
You can disable the 64-bit compilation for your application by going to the settings of your objectives> build, but I would highly recommend that you do not. In addition, the following code works for me: it also introduces a new method of creating and correctly perform authorization checks (this ensures that the user has given permission for your application to access your contacts)
CFErrorRef * err; ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, err); ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) { if (!granted) { ); CFErrorRef * err; ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, err); ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) { if (!granted) { , CFErrorRef error) { CFErrorRef * err; ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, err); ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) { if (!granted) {
Although if I wanted to be really picky, I would say that you should probably include an array of people in NSArray as follows:
NSArray *people = (__bridge_transfer NSArray*)ABAddressBookCopyArrayOfAllPeople(addressBook);
Then consider using your sorting methods using NSSortDescriptors , as they are likely to be faster and certainly more modern way of doing things.
source share