开发者

iphone version of Android contacts attributes?

I'm looking for a way to query contacts in my iPhone app based on a few things. Fir开发者_JS百科st I only want contacts that have a phonenumber. Second, id like to sort the contacts in order of the number of times contacted.

Android provides attributes that makes this possible and easy to do.


I can't really say that I know the answer, but I believe I know where to find the answer:

http://developer.apple.com/library/ios/#documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Introduction.html#//apple_ref/doc/uid/TP40007744-CH1-SW1

Here are some quotes from that document that seems relevant:

There are two ways to find a person record in the Address Book database: by name, using the function ABAddressBookCopyPeopleWithName, and by record identifier, using the function ABAddressBookGetPersonWithRecordID. To accomplish other kinds of searches, use the function ABAddressBookCopyArrayOfAllPeople and then filter the results using the NSArray method filteredArrayUsingPredicate:.

To sort an array of people, use the function CFArraySortValues with the function ABPersonComparePeopleByName as the comparator and a context of the type ABPersonSortOrdering. The user’s desired sort order, as returned by ABPersonGetSortOrdering, is generally the preferred context.

Those quotes were both found on this page. I hope it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜