3

I have this code:

   CFArrayRef contactsList = ABAddressBookCopyArrayOfAllPeople(addressBookRef); 

   CFMutableArrayRef peopleMutable = CFArrayCreateMutableCopy(kCFAllocatorDefault, CFArrayGetCount(contactsList), contactsList);

   CFArraySortValues(peopleMutable, CFRangeMake(0, CFArrayGetCount(peopleMutable)), (CFComparatorFunction) ABPersonComparePeopleByName, (void*) ABPersonGetSortOrdering());

   CFIndex personCount = ABAddressBookGetPersonCount(addressBookRef);

Before on previous iOS it works but when I upgraded my xcode to latest version and my device to latest iOS I'm getting zero return. My project is not in ARC.

What happened here? And how address book return 0?

Toseef Khilji
  • 17,192
  • 12
  • 80
  • 121
Arnlee Vizcayno
  • 2,405
  • 3
  • 23
  • 31

1 Answers1

0

I had same problem, I found the reason and solution. The reason is iOS 6 does not permit to access contacts.

You can find solution:

iOS 6 Address Book not working?

Programmatically Request Access to Contacts

Community
  • 1
  • 1
dobiho
  • 1,025
  • 1
  • 11
  • 22