本文介绍了ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering的代码示例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有人有一个代码示例,说明如何正确设置参数并使用ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering()API来获取iPhone联系人列表的已排序子集?
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?
推荐答案
以下内容应该有效:
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
这篇关于ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering的代码示例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!