iPhone通讯录:如何获取仅包含电话号码的联系人列表?
我想获取所有具有电话号码的 ABContacts 的列表,并且仅获取这些联系人。我不想显示任何仅包含电子邮件的联系人。
Android 有一个名为 HAS_PHNONE_NUMBER 的字段,您可以查询该字段,但我没有在 iPhone 上看到类似的字段。
例如:
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook);
//How do I filter people into an array of contacts that all have a phone number?
I'd like to get a list of all ABContacts that have a phone number and only those contacts. Any contacts with just an email I do not want to show.
Android has a field called HAS_PHNONE_NUMBER you can query on but I'm not seeing anything like that for iPhone.
For example:
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook);
//How do I filter people into an array of contacts that all have a phone number?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用此代码片段
You can use this code snippet
在 iOS 中没有像这样的简单方法或帮助,您必须解析数组,如果您正在解析的人有电话号码或电话号码列表不为空,则将其添加到最终数组中。
There is no easy way or help like this in iOS, you have to parse your Array and if the people you are parsing have a phone number or a list of phones number not empty you add it to your final Array.