我得到的错误:
Undefined symbols for architecture armv7:
“Swift.UnsafeMutableBufferPointer.(subscript.materializeForSet :
(Swift.Int) -> A).(closure #1)”,referenced from:
function signature specialization of generic specializationwith
Swift.UnsafeMutableBufferPointer :
Swift.MutableCollection in Swift and
Swift.UnsafeMutableBufferPointer :
Swift.RandomAccessCollection in Swift> of Swift._siftDown (inout A,
index : A.Index,subRange : Swift.Range,by : inout
(A.Iterator.Element,A.Iterator.Element) -> Swift.Bool) -> () in
OrderCoordinator.o
function signature specialization of generic specializationwith
Swift.UnsafeMutableBufferPointer :
Swift.MutableCollection in Swift and
Swift.UnsafeMutableBufferPointer :
Swift.RandomAccessCollection in Swift> of Swift._heapSort (inout A,
subRange : Swift.Range,by : inout (A.Iterator.Element,
A.Iterator.Element) -> Swift.Bool) -> () in OrderCoordinator.o
function signature specialization of generic specializationwith
Swift.UnsafeMutableBufferPointer :
Swift.MutableCollection in Swift and
Swift.UnsafeMutableBufferPointer :
Swift.RandomAccessCollection in Swift> of Swift._partition (inout A,
A.Iterator.Element) -> Swift.Bool) -> A.Index in OrderCoordinator.o
ld: symbol(s) not found for architecture armv7 clang: error: linker
command Failed with exit code 1 (use -v to see invocation)
func didFinishWithResults(_ results: [PhotoProcessorResult]) { guard let album = albumService.currentAlbum else { return } //let sortedResults = results.sorted(by: { $0.fileIndex < $1.fileIndex }) let updateItems = zip(sortedResults,album.assetItems).map { (photoProcessorResult,assetItem) -> UpdateItem in UpdateItem(path: photoProcessorResult.filePath,position: photoProcessorResult.fileIndex,isCover: assetItem.isCover) } albumService.updateAlbumWithItems(updateItems) { (success,errorDescription) in if success { self.handleAlbumUpdate() } else { self.showFailureAlert(errorDescription) { self.startProcessingAlbum(self.albumService.currentAlbum) } } } }
虽然我通过使用NSArray对数据进行排序来解决问题,但我不喜欢这种解决方案.
将不胜感激任何建议.
解决方法
let sortedResults = results.sorted(by: { $0.fileIndex < $1.fileIndex })
你可以改成它:
let sortedResults = results.sorted { (first,second) -> Bool in return first.fileIndex < second.fileIndex }
它解决了你的问题吗?