如何对 iPhone 通讯录进行排序?
我如何按名字和名字对 iPhone 通讯录进行排序(或检索排序数组)以编程方式显示姓氏?
任何帮助将不胜感激...! 谢谢
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我如何按名字和名字对 iPhone 通讯录进行排序(或检索排序数组)以编程方式显示姓氏?
任何帮助将不胜感激...! 谢谢
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
调用
ABAddressBookCopyArrayOfAllPeople()
获取地址簿中所有人员记录的数组。然后按照 文档:Call
ABAddressBookCopyArrayOfAllPeople()
to get an array of all person records in the address book. Then follow the documentation:怎么样:--
在
ABPerson.h
中声明How about this:--
declared in
ABPerson.h
我正在使用上面的代码(来自已批准的答案)从 iPhone 复制地址簿,并使用
ABPersonComparePeopleByName
对地址簿进行排序。但发现对于同一个通讯录,当iPhone的国际语言不同时,会有不同的排序结果。 假设根据不同的标准对不同的语言进行排序是合理的。所以在我们的项目中我们有“en.lproj”..“zh-hant.lproj”...“ja.lproj”,在NSCalendar
中,我们还有“locale”设置。所以我在想如何设置ABPersonComparePeopleByName
的标准并询问Apple。一个非常有用的回复:“排序顺序不可预测”。苹果回复的相关部分如下:
I am using the above code (from the approved answer) to copy address book from iPhone, and also used
ABPersonComparePeopleByName
for sorting the address book. But found that it will have different sorting results for the same address book, when the international language of the iPhone is different. Suppose it is reasonable to sort different languages based on different criteria. So in our project we have "en.lproj".."zh-hant.lproj"..."ja.lproj", InNSCalendar
, we also have "locale" setting. So I am thinking how to set the criteria forABPersonComparePeopleByName
and asked Apple. A very helpful reply: "a sort order is not predictable".The relevant portion of Apple's reply is below: