iPhone sdk: How do I get a count of all the phone numbers in a address book?
Hi i am developing an app for my QA department. I need to programical开发者_StackOverflow社区ly get how many phone numbers are there in the entire address book. No user input. Just click a button and then get how many phonenumbers are there in the ENTIRE addressbook.
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.
from what I can tell from a quick look at ABMultiValue
in AddressBook.sqlitedb
, you might get it like this:
1 - sqlite to /var/mobile/Library/AddressBook/AddressBook.sqlitedb
2 - SELECT value FROM ABMultiValue
=> into some array
3 - 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?
精彩评论