iPhone sdk:如何获取地址簿中所有电话号码的计数?
您好,我正在为我的 QA 部门开发一个应用程序。我需要以编程方式获取整个地址簿中有多少个电话号码。没有用户输入。只需单击一个按钮,然后即可获取整个地址簿中有多少个电话号码。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
您好,我正在为我的 QA 部门开发一个应用程序。我需要以编程方式获取整个地址簿中有多少个电话号码。没有用户输入。只需单击一个按钮,然后即可获取整个地址簿中有多少个电话号码。
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
我认为您正在寻找的是 ABGroupCopyArrayOfAllMembers。请参阅 AddressBook 编程指南 和 QuickContacts 示例,了解有关使用 AB 框架的更多信息。
I think what you are looking for is ABGroupCopyArrayOfAllMembers. See the AddressBook Programming Guide and the QuickContacts example for more info on using the AB framework.
从我快速查看
AddressBook.sqlitedb
中的ABMultiValue
可以看出,您可能会得到这样的结果:1 - sqlite 到
/var/mobile/Library /AddressBook/AddressBook.sqlitedb
2 -
从 ABMultiValue 选择值
=>进入某个数组3 - 计算其中与
/^[0-9 +]+$/
匹配的所有内容,四处寻找更多帮助来完成这些步骤
编辑:可能还有一些方法可以做到这一点方法:
如何获取某人的电话号码从通讯录中?
from what I can tell from a quick look at
ABMultiValue
inAddressBook.sqlitedb
, you might get it like this:1 - sqlite to
/var/mobile/Library/AddressBook/AddressBook.sqlitedb
2 -
SELECT value FROM ABMultiValue
=> into some array3 - count everything in there that matches
/^[0-9 +]+$/
look around for some more help doing these steps
Edit: there's probably also some way to do it with this method:
How do you get a persons phone number from the address book?