I know that I can sort with CNContacts like this:
let fetch = CNContactFetchRequest(...)
fetch.sortOrder = .UserDefault
The question is: how do I find what is that sort order? Apart from some hacky heuristic of examining what comes back from the fetch enumeration.
There is an old ABPersonGetSortOrdering() call that will probably stay around for a while, but surely there is a CNContact way to do it.
ABPersonGetSortOrdering()
was deprecated in iOS 9.0: use [[CNContactsUserDefaults sharedDefaults] sortOrder]
let sortOrder = CNContactsUserDefaults.sharedDefaults().sortOrder
Swift 4
Using the default sort Order :
let sortOrder = CNContactsUserDefaults.shared().sortOrder
For Custom Sort Order ie
let customSortOrder = CNContactSortOrder.givenName
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.