how to sort iphone contact book?

后端 未结 3 383
囚心锁ツ
囚心锁ツ 2021-02-01 08:10

How can i sort (or retrieve sorted array of ) an iphone contact book by first name & last name programmatically ??

Any help will be well appreciated...! Thanks

3条回答
  •  难免孤独
    2021-02-01 08:59

    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", In NSCalendar, we also have "locale" setting. So I am thinking how to set the criteria for ABPersonComparePeopleByName and asked Apple. A very helpful reply: "a sort order is not predictable".

    The relevant portion of Apple's reply is below:

    This is actually normal behavior. Sorting in different languages is actually an incredibly complex issue where the expectation of the user vary widely depending on language/location. Honestly, your best option is to adjust your expectations and assume that the sort order is not predictable. Any other approach is very likely to annoy and confuse many international users.

    -Kevin

    Kevin Elliott, DTS Engineer, kevin_elliott@apple,com

提交回复
热议问题