CFArraySortValues在Objective-C聯繫人排序,如下我樣的人的數組。以下:與斯威夫特
let ctx = UnsafeMutablePointer<Void>.alloc(kABPersonSortByFirstName)
CFArraySortValues(mutablePeople,
CFRangeMake(0, CFArrayGetCount(mutablePeople)),
ABPersonComparePeopleByName,
ctx)
給出編譯錯誤:
Cannot invoke 'CFArraySortValues' with an argument list of type '(CFMutableArray!, CFRange, (ABRecord!, ABRecord!, ABPersonSortOrdering) -> CFComparisonResult, UnsafeMutablePointer)'
的問題看起來是與將在Objective-C被轉換爲CFComparatorFunction
的ABPersonComparePeopleByName
。
兩個很好的答案,正是我所需要的,謝謝。 –