Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code example for ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering?

Tags:

ios

iphone

ios4

Does anyone have a code example of how to properly set up the parameters and use the ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering() API to get sorted subsets of the iPhone Contact list?

like image 287
hotpaw2 Avatar asked Jan 09 '11 19:01

hotpaw2


1 Answers

The following should work:

ABAddressBookRef aB = ABAddressBookCreate();
ABRecordRef source = ABAddressBookCopyDefaultSource(aB); // or get the source with ABPersonCopySource(somePersonsABRecordRef);
NSArray *arr = (NSArray *)ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering(aB, source, kABPersonSortByLastName);
// you can also use kABPersonSortByFirstName instead of kABPersonSortByLastName
like image 168
mrueg Avatar answered Nov 04 '22 18:11

mrueg