本文介绍了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 的代码示例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!