When implementing a view similar to an ABPeoplePickerNavigationController
, I'm not able to sort the list very quickly. The native contacts app loads the list instantly. I'm dealing with 4000+ contacts, so keeping load times down is important. I can't use the ABPeoplePickerNavigationController
because I need to do a lot of custom UI work.
I was using ABAddressBookCopyArrayOfAllPeople
, then placing the people in UILocalizedIndexedCollation
sections using sectionForObject and then sorting the sections using sortedArrayFromArray
. For 4000 contacts, my time was about 8 seconds.
I then switched to using ABAddressBookCopyArrayOfAllSources
and for every source, ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering
and just appending each source's contacts to the unsorted array, then using the same UILocalizedIndexedCollation
technique. This dropped the time down to about 5 seconds, I guess since the sections were mostly sorted already.
Is there any way to improve on this? Any techniques I'm not aware of? Can I somehow load an ABPeoplePickerNavigationController
data source without the view and use that? Or is there a faster sorting method?
Thanks very much.